ReactBeginner#jsx

What is conditional rendering in React?

Return different JSX based on state using ternaries, && or early returns. Careful with && and numbers, because 0 renders as '0'.

Example
{loading ? <Spinner /> : <List items={items} />}
{items.length > 0 && <Footer />}
{count !== 0 && <Badge n={count} />}

Related Questions

1
ReactAdvanced#errors

What is an error boundary?

Open
2
ReactIntermediate#lifecycle#hooks

How does the component lifecycle map to hooks?

Open
3
ReactAdvanced#performance

What is lazy loading and code splitting in React?

Open