From 47483a3f6a68535fabacedbf97f606d750fc0b0c Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Sat, 3 Sep 2022 22:58:46 +0800 Subject: [PATCH] [Beta] fix a broken link (#4968) --- beta/src/pages/learn/you-might-not-need-an-effect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beta/src/pages/learn/you-might-not-need-an-effect.md b/beta/src/pages/learn/you-might-not-need-an-effect.md index 0f648128..85bb90d1 100644 --- a/beta/src/pages/learn/you-might-not-need-an-effect.md +++ b/beta/src/pages/learn/you-might-not-need-an-effect.md @@ -714,7 +714,7 @@ This might seem like a contradiction with the earlier examples where you needed However, the code above has a bug. Imagine you type `"hello"` fast. Then the `query` will change from `"h"`, to `"he"`, `"hel"`, `"hell"`, and `"hello"`. This will kick off separate fetches, but there is no guarantee about which order the responses will arrive in. For example, the `"hell"` response may arrive *after* the `"hello"` response. Since it will call `setResults()` last, you will be displaying the wrong search results. This is called a ["race condition"](https://en.wikipedia.org/wiki/Race_condition): two different requests "raced" against each other and came in a different order than you expected. -**To fix the race condition, you need to [add a cleanup function](learn/synchronizing-with-effects#fetching-data) to ignore stale responses:** +**To fix the race condition, you need to [add a cleanup function](/learn/synchronizing-with-effects#fetching-data) to ignore stale responses:** ```js {5,7,9,11-13} function SearchResults({ query }) {