Overview
ThesetOptions() function allows you to modify React Scan configuration options dynamically at runtime. This is useful for toggling features or updating settings without reinitializing.
Signature
Parameters
Partial configuration object with options to update. Only the specified options will be changed; others remain unchanged.
Returns
Returns the updated options object if successful, or
undefined if an error occurred during validation.Usage
Toggle Scanning
Update Multiple Options
Toggle Toolbar Visibility
Enable Production Mode
Track Unnecessary Renders
Tracking unnecessary renders can add meaningful overhead to React Scan. An unnecessary render is defined as a component re-rendering with no change to the component’s corresponding DOM subtree.
Validation
The function validates all provided options:- Boolean options must be valid booleans
animationSpeedmust be one of:'slow','fast', or'off'- Callback options (
onCommitStart,onRender,onCommitFinish) must be functions - Unknown options will trigger a console warning
- Invalid options are ignored and not applied
Error Handling
Persistence
Options set viasetOptions() are automatically persisted to localStorage (except for callback functions). They will be restored when React Scan initializes on subsequent page loads.
See Also
- getOptions() - Get current options
- scan() - Initialize with options
- Options - Full options reference