Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

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.


view as:

Couldn't useState accept a name? How would React DevTools or another debugging tool know the name of a piece of state?

I'm at ReactConf right now and I've been asking everyone this exact question.

Legal | privacy