From ac0985f8adc54e8172b1e81f9a5616d9d3cd0d2c Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Tue, 14 Jun 2022 05:04:18 +0100 Subject: [PATCH] typo --- beta/src/pages/learn/synchronizing-with-effects.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beta/src/pages/learn/synchronizing-with-effects.md b/beta/src/pages/learn/synchronizing-with-effects.md index ddd079b0..89e0ae03 100644 --- a/beta/src/pages/learn/synchronizing-with-effects.md +++ b/beta/src/pages/learn/synchronizing-with-effects.md @@ -825,7 +825,7 @@ Expand the console panel in the sandbox above. You will see three logs at first: `Schedule "a" log`, `Cancel "a" log`, and `Schedule "a" log` again. Three second later there will also be a log saying `a`. As you learned earlier on this page, the extra schedule/cancel pair is because **React remounts the component once in development to verify that you've implemented cleanup well.** -Now edit the input to say `abc`. If you do it fast enough, you'll see `Schedule "ab" log` immediately followed by `Cancel "ab" log` and `Schedule "abc" log`. **React always cleans up the previous render's Effect before the next render's Effect.** This is why you even if you type into the input fast, there is at most one timeout scheduled at a time. Edit the input a few times and watch the console to get a feel for how Effects get cleaned up. +Now edit the input to say `abc`. If you do it fast enough, you'll see `Schedule "ab" log` immediately followed by `Cancel "ab" log` and `Schedule "abc" log`. **React always cleans up the previous render's Effect before the next render's Effect.** This is why even if you type into the input fast, there is at most one timeout scheduled at a time. Edit the input a few times and watch the console to get a feel for how Effects get cleaned up. Type something into the input and then immediately press "Unmount the component." **Notice how unmounting cleans up the last render's Effect.** In this example, it clears the last timeout before it has a chance to fire.