From c43429a9b184c4e9e20f4bcd00df7df45a9c9747 Mon Sep 17 00:00:00 2001 From: Vishnu D <149229313+vishnudt2004@users.noreply.github.com> Date: Wed, 18 Jun 2025 10:04:44 +0530 Subject: [PATCH] fix(curriculum): update steps 15-16 in fruit search app workshop (#60906) Co-authored-by: Ilenia <26656284+ilenia-magoni@users.noreply.github.com> --- .../workshop-fruit-search-app/67f90574263ebf363f9edd1d.md | 6 +++--- .../workshop-fruit-search-app/6813e49f0a3ec06c1e80c93b.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/67f90574263ebf363f9edd1d.md b/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/67f90574263ebf363f9edd1d.md index 7e69e7991e9..69b12557018 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/67f90574263ebf363f9edd1d.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/67f90574263ebf363f9edd1d.md @@ -9,7 +9,7 @@ dashedName: step-15 If `query` is not empty, you want to get fruits that match the user input from the API, but only after users stop typing for a short period to avoid making the fetch call too frequently. -To start, after the `if` statement, call `setTimeout` with a delay value of `700` and store it in a variable called `timeoutId`. This allows you to cancel the timeout later when the effect cleans up. +To start, after the `if` statement, call `setTimeout` with an empty arrow function and a delay value of `700` as arguments, and store it in a variable called `timeoutId`. This allows you to cancel the timeout later when the effect cleans up. # --hints-- @@ -19,10 +19,10 @@ You should call `setTimeout` and store the return value in a variable called `ti assert.match(code, /(const|let|var)\s+timeoutId\s*=\s*setTimeout\s*\(/s); ``` -`setTimeout` should have a delay value of `700`. +`setTimeout` should have an empty callback function and a delay value of `700`. ```js -assert.match(code, /(const|let|var)\s+timeoutId\s*=\s*setTimeout\s*\(\s*700\s*\)/); +assert.match(code, /(const|let|var)\s+timeoutId\s*=\s*setTimeout\s*\(\s*\(\s*\)\s*=>\s*\{\s*\}\s*,\s*700\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/6813e49f0a3ec06c1e80c93b.md b/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/6813e49f0a3ec06c1e80c93b.md index 8ea3e00c12c..4fa40db6c5c 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/6813e49f0a3ec06c1e80c93b.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/6813e49f0a3ec06c1e80c93b.md @@ -7,11 +7,11 @@ dashedName: step-16 # --description-- -The first argument to `setTimeout`, before the delay value, should be an `async` arrow function, which allows you to use `await` inside the delayed logic. Inside that function, create a `try...catch` block to handle potential errors while fetching data. +Update the first argument to `setTimeout` to an `async` arrow function. This allows you to use `await` inside the delayed logic. Inside that function, create a `try...catch` block to handle any potential errors when fetching data. # --hints-- -You should use an `async` arrow function as the first argument to `setTimeout`. +You should have an `async` arrow function as the first argument to `setTimeout`. ```js assert.match(code, /setTimeout\s*\(\s*async\s*\(\s*\)\s*=>\s*{/); @@ -115,7 +115,7 @@ export function FruitsSearch() { setResults([]); return; } - const timeoutId = setTimeout(700); + const timeoutId = setTimeout(() => {}, 700); }, [query]); --fcc-editable-region--