Skip to content

Commit bc890f7

Browse files
docs: Update example-setstate.mdx (#829)
Fixed writing mistakes.
1 parent 16a3d0f commit bc890f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

website/docs/example-setstate.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ title: React & Immer
3333

3434
## useState + Immer
3535

36-
The `useState` hook assumes any state that is stored inside it is treated as immutable. Deep updates in the state of React components can be greatly simplified as by using Immer. To following example shows how to use `produce` in combination with `useState`, and can be tried on [CodeSandbox](https://codesandbox.io/s/immer-usestate-ujkgg?file=/src/index.js).
36+
The `useState` hook assumes any state that is stored inside it is treated as immutable. Deep updates in the state of React components can be greatly simplified as by using Immer. The following example shows how to use `produce` in combination with `useState`, and can be tried on [CodeSandbox](https://codesandbox.io/s/immer-usestate-ujkgg?file=/src/index.js).
3737

3838
```javascript
3939
import React, { useCallback, useState } from "react";
@@ -80,7 +80,7 @@ const TodoList = () => {
8080

8181
## useImmer
8282

83-
Since all state updaters follow the same pattern where the update function is wrapped in `produce`, it is also possible to simply the above by leveraging the [use-immer](https://www.npmjs.com/package/use-immer) package that will wrap updater functions in `produce` automatically:
83+
Since all state updaters follow the same pattern where the update function is wrapped in `produce`, it is also possible to simplify the above by leveraging the [use-immer](https://www.npmjs.com/package/use-immer) package that will wrap updater functions in `produce` automatically:
8484

8585
```javascript
8686
import React, { useCallback } from "react";

0 commit comments

Comments
 (0)