Skip to content

Commit 4f1d985

Browse files
Update synchronizing-with-effects.md (#6856)
* Update synchronizing-with-effects.md Currently documentation says: By default, your Effect will run after every render. Which is in contrast with another section of the same page where it says: Effects run at the end of a commit after the screen updates * Update src/content/learn/synchronizing-with-effects.md --------- Co-authored-by: Ricky <[email protected]>
1 parent f9b9b66 commit 4f1d985

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/learn/synchronizing-with-effects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Here and later in this text, capitalized "Effect" refers to the React-specific d
4545

4646
To write an Effect, follow these three steps:
4747

48-
1. **Declare an Effect.** By default, your Effect will run after every render.
48+
1. **Declare an Effect.** By default, your Effect will run after every [commit](/learn/render-and-commit).
4949
2. **Specify the Effect dependencies.** Most Effects should only re-run *when needed* rather than after every render. For example, a fade-in animation should only trigger when a component appears. Connecting and disconnecting to a chat room should only happen when the component appears and disappears, or when the chat room changes. You will learn how to control this by specifying *dependencies.*
5050
3. **Add cleanup if needed.** Some Effects need to specify how to stop, undo, or clean up whatever they were doing. For example, "connect" needs "disconnect", "subscribe" needs "unsubscribe", and "fetch" needs either "cancel" or "ignore". You will learn how to do this by returning a *cleanup function*.
5151

0 commit comments

Comments
 (0)