dallbit Prompt & Skill

State Management Refactor

Improves complex component state flows and resolves prop drilling and re-renders.

Prompt Template

The more specific your inputs, the higher the quality of the output.

{{framework_name}}
{{component_code}}

You are a frontend architecture expert. Refactor the state management in the following React component for efficiency. ### Component Code function App() { const [data, setData] = useState(); ... } ### Optimization Focus - **Eliminate Prop Drilling**: Lift state to the appropriate level or utilize Context/Store. - **Remove Redundant State**: Delete unnecessary states that can be derived from others. - **Performance**: Use memoization (memo, useMemo) to prevent redundant re-renders. ### Deliverables - Improved code with clear state flow. - Explanation of the performance impact of each change.