Passing Props between Layout and Children in Gatsby with useContext

It looks like a lot, but having a context for each action actually improves performance by preventing unnecessary re-renders.
Do this for each of the contexts you create.
Make sure to also pass children to your ContextProvider.
Now I can call menu to read the state, and () => toggleMenu(!menu) to change it.
Read method in action.
Write method in action.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store