React Hooks, a new feature of React v16.7.0-alpha, is a hacky implementation, so there are restrictions that must be called in order. https://reactjs.org/docs/hooks-rules.html
One of React members says below: > Finally, if you’re a functional programming purist and feel uneasy about React relying on mutable state as an implementation detail, you might find it satisfactory that handling Hooks could be implemented in a pure way using algebraic effects (if JavaScript supported them). And of course React has always relied on mutable state internally — precisely so that you don’t have to. https://medium.com/@dan_abramov/making-sense-of-react-hooks-fdbde8803889 IMHO, it's worth considering that we'll include Algebraic Effects specifications in ECMAScript. _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

