4 ms·
But why would you even change the order? I don't understand how can this be an issue if you treat it as a static declaration which it simulates.
by TomMarius 7y ago
But why would you even change the order? I don't understand how can this be an issue if you treat it as a static declaration which it simulates.
- rssbnjmnfrncs 7y agoWhat if you wanted to return early in the component? E.g. a hook has returned a certain value and you now want to stop all other execution and return null. With hooks you can't as that would change the order.
- TomMarius 7y agoYeah but you also wouldn't try to return in the middle of function argument declarations. I know it's a little weird, but just treat it as a declaration block and you won't have any problems, what you're proposing is impossible with react architecture as a whole anyways (because the next component would get wrong state cells, it's a stack).