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
Copy file name to clipboardExpand all lines: src/content/reference/react/useEffectEvent.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ function Page({ url }) {
90
90
}
91
91
```
92
92
93
-
In this example, the Effect should re-run after a render when `url` changes (to log the new page visit), but it should **not**re-run when `numberOfItems` changes. By wrapping the logging logic in an Effect Event, `numberOfItems`becomes non-reactive. It's always read from the latest value without triggering the Effect.
You can pass reactive values like `url`as arguments to the Effect Event to keep them reactive while accessing the latest non-reactive values inside the event.
0 commit comments