yuchi / hooks.macro

☔️ Babel Macros for automatic React Hooks memoization invalidation
MIT License
357 stars 5 forks source link

State values with unused setters are known to be static (if const) #11

Closed yuchi closed 4 years ago

yuchi commented 4 years ago

In the following example the setter for the state is never exposed (and therefore used) so id is known to be static.

const [id] = React.useState(Math.random);