From b83c747ccd363e6a9bf24039c2c05a0577ee52cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giftea=20=E2=98=95?= Date: Fri, 8 Aug 2025 23:38:14 +0100 Subject: [PATCH] fix(curriculum): Explain Controlled Inputs in Fruit Search App (#61266) Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> Co-authored-by: Sem Bauke --- .../67ed044dc76cf4a441618f2c.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/67ed044dc76cf4a441618f2c.md b/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/67ed044dc76cf4a441618f2c.md index 9a1e5a295e6..305143a1a11 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/67ed044dc76cf4a441618f2c.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-fruit-search-app/67ed044dc76cf4a441618f2c.md @@ -7,7 +7,22 @@ dashedName: step-5 # --description-- -In previous lectures, you learned about controlled inputs, where form elements are tied directly to state variables in React. +In React, controlled inputs are a standard way to handle form data, where the input's value is synced with the component's state. + +```jsx +const MyForm = () => { + const [name, setName] = useState(""); + + return ( + <> + + + + ); +} +``` + +You will learn more about this pattern in a future lesson. To track what the user types into the search input field, create a state variable named `query` with an initial value of an empty string (`''`). Also define its corresponding setter function, `setQuery`, using the `useState` Hook.