Description
Do you want to request a feature or report a bug?
Feature, in form of a question.
Might be infeasible. Vaguely relates to #14110.
What is the current behavior?
If a function component does use more or less hooks between re-renders, an error is thrown.
This contrasts with other implementations that allow this, such as TNG-Hooks.
What is the expected behavior?
Would it be possible to return early if values returned by hooks do not require subsequent hooks and values to be processed?
The documentation states that we must "ensure that Hooks are called in the same order each time a component renders". It seems that using more or less hooks wouldn't break that rule, as long as, during a render, the sequence of used hooks either contains or is a sub-sequence of the longest hooks sequence from all previous renders.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
v16.8.1