5 hands-on exercises and 5 find-the-bug challenges for the What a Component Can Return lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Return plain text from a component, with no wrapping element.
Return a computed number directly from the component.
A Banner with no text should return null, so only the second one appears.
Return two elements as an array, each with a key.
Return a fallback when the list is empty, otherwise the count.
The component computes JSX but never returns it.
A return followed by a newline returns undefined.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceReturning false renders nothing at all; return the fallback instead.
The guard runs after the value it was meant to protect is used.
React cannot render a plain object; render a field from it.