remediate_component
Optimizes React components by hoisting static code, memoizing unstable props with useCallback/useMemo, and applying React.memo when ROI exceeds 1.5. Edits the component file directly.
Instructions
Automatically optimizes a React component's AST by hoisting static declarations, wrapping unstable callbacks/objects in useCallback/useMemo, and wrapping the component in React.memo if the ROI score is above 1.5. Mutates the file on disk.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Absolute path to the React component file on disk | |
| roi_score | Yes | Estimated ROI score from profiling (usually 0 to 5) justifying memoization overhead | |
| component_name | Yes | Name of the React component to optimize | |
| unstable_props | Yes | Comma-separated or space-separated list of props to memoize/wrap in hooks |