mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
example should import useReducer (#4504)
This commit is contained in:
@@ -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) {
|
||||
// ...
|
||||
|
||||
Reference in New Issue
Block a user