Re:Two custom React hooks
by fastball on Friday December 17, 2021 @08:15PM
(#29600452)
Normally syntactic sugar is fine and has a near-zero cost, but in this case I don't think that's actually true.
Given the way hooks are structured, if I want to use both `setState` and `extendState` in a `useCallback`, I'd need to pass both to the dependency array, which is just extra effort (which defeats the purpose of the syntactic sugar imo).
Given the way hooks are structured, if I want to use both `setState` and `extendState` in a `useCallback`, I'd need to pass both to the dependency array, which is just extra effort (which defeats the purpose of the syntactic sugar imo).