Hacker News new | ask | show | jobs
by RussianCow 2475 days ago
The issue I have with the "rules of hooks" is that it makes some previously trivial things cumbersome at best, and downright complicated at worst. For a quick example, something as simple as mapping an array onto a series of elements with a callback requires (as far as I can tell) that the inner element be broken out into its own component that calls `useCallback`, since you can't create a unique callback for each item in the parent.
1 comments

You don't need to use hooks there. You can just define your functions and be done with it.
You do if you don't want those child components to be re-rendered needlessly when some higher-level state changes.