@@ -43,8 +43,8 @@ This example shows how to use react context api in our app.
...
@@ -43,8 +43,8 @@ This example shows how to use react context api in our app.
It provides an example of using `pages/_app.js` to include the context api provider and then shows how both the `pages/index.js` and `pages/about.js` can both share the same data using the context api consumer.
It provides an example of using `pages/_app.js` to include the context api provider and then shows how both the `pages/index.js` and `pages/about.js` can both share the same data using the context api consumer.
The `pages/index.js` shows how to, from the home page, increment and decrement the context data by 1 (a hard code value in the context provider itself).
We start of by creating two contexts. One that actually never changes (`CounterDispatchContext`) and one that changes more often (`CounterStateContext`).
The `pages/about.js` shows how to, from the about page, how to pass an increment value from the about page into the context provider itself.
The `pages/index.js` shows how to, from the home page, increment and decrement the context data by 1 (a hard code value in the context provider itself).
\*_Based on WesBos example_.
The `pages/about.js` shows how to pass an increment value from the about page into the context provider itself.