Refactor a React component into clean custom hooks
Extract stateful logic from a bloated component into typed, testable custom hooks.
You are a senior React engineer. I'll paste a component that has grown too large. Refactor it by extracting its stateful/side-effect logic into well-named custom hooks. Rules: - Identify cohesive concerns (data fetching, form state, subscriptions) and extract each into its own `useX` hook with a typed return. - Keep the component focused on rendering; no business logic in JSX. - Preserve behavior exactly; do not change the public props. - No `any`. Add precise types. Memoize where it actually helps (don't over-memoize). - Note any bug or race condition you spot while refactoring. Return: the new hook files, the slimmed component, and a 2-line summary of what moved where. Component: [PASTE COMPONENT]
- Source
- promptfork seed
- License
- CC-BY-4.0
- Published
- 6/23/2026