early return
Leaving a function before its end with a return statement, usually after checking a condition.
In more detail
Normal hooks must not come after an early return, because they would be skipped in some renders. The use API is allowed there.
Related terms
- Rules of Hooks — The two rules for hooks: call them only at the top level, never in conditions, loops or nested functions, and only from React components or custom hooks.
- use() — The React 19 API that reads a value from a Promise or a context, and unlike hooks may be called inside conditions and loops.
Taught in
- The use() Hook: Reading Promises And Context Directly — React 19 & Modern Component Architecture