Overview
TheignoreScan() function marks React elements to be excluded from React Scan’s render tracking and highlighting. This is useful for preventing animations, tooltips, or other frequently-updating components from cluttering the scan visualization.
Signature
Parameters
The React node to exclude from scanning. Must be a valid React element object (not primitives like strings, numbers, or booleans).Valid types:
- React elements created with JSX or
React.createElement() - Component instances
- Fragments
nullorundefined- Strings, numbers, booleans, or bigints
Returns
void - This function does not return a value.
Usage
Ignore Animated Components
Ignore High-Frequency Updates
Ignore Tooltip Components
Ignore List Items
Ignore Fragments
Conditional Ignoring
How It Works
Internally,ignoreScan() maintains a WeakSet of ignored React nodes. When React Scan processes renders:
- It checks if the rendered element is in the ignored set
- If found, the element and its children are excluded from:
- Render highlighting
- Performance tracking
- Render count statistics
- Console logging (if enabled)
Best Practices
When to Use
- High-frequency updates: Components that update many times per second (clocks, animations, live data)
- Visual noise reduction: Elements that render frequently but aren’t important for performance analysis
- Third-party components: External library components you don’t control
- Known performant code: Components you’ve already optimized and don’t need to track
When Not to Use
- Don’t ignore everything: Defeats the purpose of React Scan
- Don’t ignore performance issues: If a component is slow, investigate instead of hiding it
- Don’t ignore by default: Only ignore components that genuinely clutter the analysis
Limitations
- Primitives (strings, numbers, booleans) are silently ignored and won’t cause errors
nullandundefinedvalues are ignored and won’t cause errors- Once a node is marked as ignored, it cannot be un-ignored without page reload
- Ignored nodes must be object references - the same element instance must be passed to
ignoreScan()
TypeScript Types
See Also
- onRender() - Monitor specific component renders
- Options - Configure global scanning behavior
- setOptions() - Toggle scanning at runtime