conditional rendering

Showing different JSX depending on a condition, using an if statement, the && operator or the conditional (ternary) operator.

In more detail

For example {isOpen && <Modal />} renders the modal only when isOpen is true. Conditionally rendering a lazy component is how interaction-based code splitting loads it on demand.

Related terms

Taught in

References