react.dev
react.dev copied to clipboard
Ambiguous `this` in the 'Synchronizing with effects'
Description
In the sentence "Sometimes this
isn't enough" it is not clear what "this" refers to. It it refers to the Event handling bullet point, then it should be the part of that bullet point.
File
https://github.com/reactjs/reactjs.org/blob/main/beta/src/content/learn/synchronizing-with-effects.md
Section:
Before getting to Effects, you need to be familiar with two types of logic inside React components:
- Rendering code ...
- Event handlers ...
Sometimes this
isn't enough. Consider a ChatRoom component that must connect to the chat server whenever it's visible on the screen. Connecting to a server is not a pure calculation (it's a side effect) so it can't happen during rendering. However, there is no single particular event like a click that causes ChatRoom to be displayed.