DEV Community

Discussion on: A Simple Guide to React Context with Hooks

Collapse
mrcrrs profile image
mrcrrs

Nice article but a mistake tripped me up; when you're creating the context wrapper with setting ability you have:

<ObjectContext value={{ object, setObject }} />

I think this should be:

<ObjectContext.Provider value={{ object, setObject }} />

Otherwise I get the "Objects are not valid as a React child context" error.