4 ms·
Yep! It is syntactic sugar. I personally like it though because it results in slightly cleaner, more concise code. It's just easier on my eyes.
by loh 5y ago
Yep! It is syntactic sugar. I personally like it though because it results in slightly cleaner, more concise code. It's just easier on my eyes.
- fastball 5y agoNormally 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).