Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/content/6/en/part6d.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ const App = () => {
const [counter, counterDispatch] = useReducer(counterReducer, 0)

return (
<CounterContext.Provider value={[counter, counterDispatch]}> // highlight-line
<CounterContext.Provider value={{counter, counterDispatch}}> // highlight-line
<Display />
<div>
<Button type='INC' label='+' />
Expand All @@ -593,14 +593,14 @@ import { useContext } from 'react' // highlight-line
import CounterContext from './CounterContext'

const Display = () => {
const [counter] = useContext(CounterContext) // highlight-line
const {counter} = useContext(CounterContext) // highlight-line
return <div>
{counter}
</div>
}

const Button = ({ type, label }) => {
const [counter, dispatch] = useContext(CounterContext) // highlight-line
const {counterDispatch} = useContext(CounterContext) // highlight-line
return (
<button onClick={() => dispatch({ type })}>
{label}
Expand Down