Browse Source

example should import useReducer (#4504)

main
victor0x16 3 years ago
committed by GitHub
parent
commit
ac68ced36e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      beta/src/pages/apis/usereducer.md

2
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) {
// ...

Loading…
Cancel
Save