5 hands-on exercises and 5 find-the-bug challenges for the useContext Explained lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Create a context and read it from a child.
Read the context with no provider above it.
Provide an object and read one field from it.
Skip a level: the grandchild reads the context directly.
Provide state through context and change it from a button.
Without a provider the child only sees the default value.
The child sits beside the provider rather than inside it.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceuseContext takes the context, and returns the value.
A provider with no value prop hands down undefined.
The provider passes a fixed string instead of the state.