3 ms·
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 e
by RussianCow 7y 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.
- aidos 7y agoYou don't need to use hooks there. You can just define your functions and be done with it.
- RussianCow 7y agoYou do if you don't want those child components to be re-rendered needlessly when some higher-level state changes.