Skip to content

Commit 6dddf1e

Browse files
committed
Fix syntax error in example
* Adds `=` for setting from `useState` * Adds style consistency to spacing around arrays
1 parent b1c3eba commit 6dddf1e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

content/articles/when-a-simple-react-context-gets-out-of-hand.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ Let's go ahead and solve that in the `TimelineContext`.
7575
```javascript
7676
const TimelineContextProvider = ({ children }) => {
7777
const [posts, setPosts] = useState([]);
78-
const [ selectedPost, setSelectedPost] useState(null)
79-
const [ selectedComment, setSelectedComment] useState(null)
78+
const [selectedPost, setSelectedPost] = useState(null)
79+
const [selectedComment, setSelectedComment] = useState(null)
8080

8181
const state = { posts, selectedPost, selectedComment };
8282
const actions = { setPosts, setSelectedPost, setSelectedComment }
@@ -104,8 +104,8 @@ This is fairly simple. We can just throw in a `useEffect` and boom.
104104
```javascript
105105
const TimelineContextProvider = ({ children }) => {
106106
const [posts, setPosts] = useState([]);
107-
const [ selectedPost, setSelectedPost] useState(null)
108-
const [ selectedComment, setSelectedComment] useState(null)
107+
const [selectedPost, setSelectedPost] = useState(null)
108+
const [selectedComment, setSelectedComment] = useState(null)
109109

110110
const state = { posts, selectedPost, selectedComment };
111111
const actions = { setPosts, setSelectedPost, setSelectedComment }

0 commit comments

Comments
 (0)