example should import useReducer (#4504)

This commit is contained in:
victor0x16
2022-03-28 10:51:41 -03:00
committed by GitHub
parent b099d558d2
commit ac68ced36e

View File

@@ -36,7 +36,7 @@ const [state, dispatch] = useReducer(reducer, initialArg, init)
Call `useReducer` at the top level of your component to manage state with a [reducer](/learn/extracting-state-logic-into-a-reducer).
```js [[1, 8, "state"], [2, 8, "dispatch"], [4, 8, "reducer"], [3, 8, "{ age: 42 }"]]
import { useState } from 'react';
import { useReducer } from 'react';
function reducer(state, action) {
// ...