Skip to content

Commit

Permalink
fix(docs): typos in using-react-context-api-with-gatsby (#11614)
Browse files Browse the repository at this point in the history
  • Loading branch information
catherineleung authored and wardpeet committed Feb 7, 2019
1 parent e61692d commit 2032147
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ First of all, you have to initialize a Gatsby project and start it in develop mo

Then, create a `context` folder within src and the `ThemeContext.js` file within it.

```jsx:title=src/contex/ThemeContext.js
```jsx:title=src/context/ThemeContext.js
import React from "react"

const defaultState = {
Expand Down Expand Up @@ -89,7 +89,7 @@ export { ThemeProvider }

Create the `ThemeProvider` component which wraps its children with `ThemeContext.Provider`. This component is exported as a named export from the file.

The `toggleDark` function gets the current `state.dark` value and switches the value to the opposite. It then stores the new value in `localStorage` before setting it back to state using the `setState` function, so that it persists over page refreshes. The dark value from `state` and the `togglDark` function are passed to the Provider.
The `toggleDark` function gets the current `state.dark` value and switches the value to the opposite. It then stores the new value in `localStorage` before setting it back to state using the `setState` function, so that it persists over page refreshes. The dark value from `state` and the `toggleDark` function are passed to the Provider.

## Modifying the Gatsby Browser file

Expand Down

0 comments on commit 2032147

Please sign in to comment.