mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-24 20:53:08 +00:00
Typo
This commit is contained in:
@@ -111,7 +111,7 @@ For this reason, the recommended way to add listeners/subscriptions is to use th
|
||||
|
||||
You may also need to update subscriptions based on changes in `props`. In this case, you should also wait until `componentDidUpdate` before _removing_ a subscription. In the event that a render is cancelled before being committed, this will prevent us from unsubscribing prematurely.
|
||||
|
||||
Howeveer, waiting to unsubscribe means that we will need to be careful about how we handle events that are dispatched in between `getDerivedStateFromProps` and `componentDidUpdate` so that we don't put stale values into the `state`. To do this, we should use the callback form of `setState` and compare the event dispatcher to the one currently in `state`.
|
||||
However, waiting to unsubscribe means that we will need to be careful about how we handle events that are dispatched in between `getDerivedStateFromProps` and `componentDidUpdate` so that we don't put stale values into the `state`. To do this, we should use the callback form of `setState` and compare the event dispatcher to the one currently in `state`.
|
||||
|
||||
Here is a example:
|
||||
`embed:update-on-async-rendering/updating-subscriptions-when-props-change-after.js`
|
||||
|
||||
Reference in New Issue
Block a user