mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-22 03:42:14 +00:00
Fix wrong documentation for effect events (#7800)
* Fix wrong documentation for effect events * Update src/content/learn/separating-events-from-effects.md --------- Co-authored-by: Ricky <rickhanlonii@gmail.com>
This commit is contained in:
@@ -439,7 +439,7 @@ function ChatRoom({ roomId, theme }) {
|
||||
// ...
|
||||
```
|
||||
|
||||
This solves the problem. Note that you had to *remove* `onConnected` from the list of your Effect's dependencies. **Effect Events are not reactive and must be omitted from dependencies.**
|
||||
This solves the problem. Note that you had to *remove* `theme` from the list of your Effect's dependencies, because it's no longer used in the Effect. You also don't need to *add* `onConnected` to it, because **Effect Events are not reactive and must be omitted from dependencies.**
|
||||
|
||||
Verify that the new behavior works as you would expect:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user