3 ms·
I think people are getting too hung up on the "implicit ordering" thing. The only thing that really matters about the ordering of hooks is that the call pattern
by mhink 8y ago
I think people are getting too hung up on the "implicit ordering" thing. The only thing that really matters about the ordering of hooks is that the call pattern remains stable between render passes. This code:
const [foo, setFoo] = useState("abc");
const [bar, setBar] = useState("123");
...is functionally the same thing as
const [bar, setBar] = useState("123");
const [foo, setFoo] = useState("abc");
The feature is _declarative_ in the same way element rendering is declarative.
- tln 8y agoCouldn't useState accept a name? How would React DevTools or another debugging tool know the name of a piece of state?
- nathancahill 8y agoI'm at ReactConf right now and I've been asking everyone this exact question.