Skip to content

Glossary: React Basics

Early return

Also written: return early

Using `if` with `return` at the start of a component to output something different, such as "Your cart is empty.", so the rest of the function doesn't run. Hooks must still be called before any early return.

Where the book teaches it

Related terms

Conditional renderingRules of hooks