Code Challenge: React Context API Array Toggle
React context API allows developers to pass data through a component tree without having to pass props manually at every level. React’s context API finds its usage in large application components required to share data at different nesting levels.
Implement your solution in the sandbox below:
Want some more challenge?
If you completed the original goal, why not try the following bonus exercise?
- Allow more foods to be added to be added to the foods array by providing a custom controlled input component.
Code challenge solution
Verify your solution with the official solution in this sandbox.
We have made available these extra resources to improve your React coding skills:
Want to conduct interviews on this platform?
Check out CoderPad : pick any interview question or create your own, then invite your candidate to a shared live-coding session on an IDE like this one. You even get 2 free interviews per month forever using this registration link!