Core API Overview > @adpt/core > ruleNoRematch
ruleNoRematch() function
Marks an element returned by a style rule to not rematch that rule.
Signature:
export declare function ruleNoRematch(info: StyleBuildInfo, elem: AdaptElement): AdaptElement<AnyProps>;
Parameters
Parameter | Type | Description |
---|---|---|
info | StyleBuildInfo | The second argument to a rule callback function. This indicates which rule to ignore matches of. |
elem | AdaptElement | The element that should not match the specified rule. |
Returns:
elem
is returned as a convenience
Remarks
This function can be used in a style rule build function to mark the props of the passed in element such that the rule associated with the info parameter will not match against the specified element.
This works by copying the set of all rules that have already matched successfully against the original element (origElement) specified in the info parameter onto the passed in elem.
Example
<Style>
{MyComponent} {Adapt.rule<MyComponentProps>(({ handle, ...props}, info) =>
ruleNoRematch(info, <MyComponent {...props} />))}
</Style>