You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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 <rickhanlonii@gmail.com>
Copy file name to clipboardExpand all lines: src/content/learn/synchronizing-with-effects.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ Here and later in this text, capitalized "Effect" refers to the React-specific d
45
45
46
46
To write an Effect, follow these three steps:
47
47
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).
49
49
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.*
50
50
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*.
0 commit comments