victor0x16
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
1 deletions
-
beta/src/pages/apis/usereducer.md
|
|
@ -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) { |
|
|
|
// ... |
|
|
|