Skip to content

Commit b86f35d

Browse files
authored
docs: fix typo in useState Adjusting derived state section (#4300)
1 parent 5d2a4e3 commit b86f35d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

beta/src/pages/apis/usestate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,6 @@ button { margin-bottom: 10px; }
853853
854854
</Sandpack>
855855
856-
Note that derived state must set be inside a condition like `prevCount !== count`, and there must be a call like `setPrevCount(count)` inside of it. Otherwise, your component would re-render in a loop until it crashes.
856+
Note that derived state must be set inside a condition like `prevCount !== count`, and there must be a call like `setPrevCount(count)` inside of it. Otherwise, your component would re-render in a loop until it crashes.
857857
858858
If you can, try to avoid derived state. However, derived state is better than updating state in an effect. When you call the `set` function during render, React will re-render that component immediately after your component exits with a `return` statement, and before rendering the children. This way, children don't need to render twice.

0 commit comments

Comments
 (0)