The library for web and native user interfaces.
Mirrored from https://github.com/247TaxiDriver/QOS-React.git
Synced Nov 14, 05:30 UTC
Dont count throw as an exit node (React semantics)
React will retry or abort components that throw (depending on a few conditions), so from React's perspective a `throw` statement is not a normal exit node. Thus the Rules of Hooks really have a caveat: the set of hooks that are called _in an execution that returns successfully_ must be consistent. Examples such as the following are therefore allowed: ```javascript function Component(props) { if (props.cond) { throw new Error(...); } useHook(); } ``` By modeling `throw` as an exit node, we rejected cases such as this. This diff changes to not model throws as exit nodes. #1584 changes this to make it an option, since some cases will want to consider throw as an exit node.