-
-
Notifications
You must be signed in to change notification settings - Fork 28
Feature Search StateΒ #17
Copy link
Copy link
Open
Labels
π Size Medium1-4 hours1-4 hoursπ
Week 3Assigned during Week 3 of this moduleAssigned during Week 3 of this moduleπ§© Feature
Metadata
Metadata
Assignees
Labels
π Size Medium1-4 hours1-4 hoursπ
Week 3Assigned during Week 3 of this moduleAssigned during Week 3 of this moduleπ§© Feature
Type
Projects
Status
π Backlog
Storing the search input in a state
Instructions:
Implement the functionality to search for a customer name given the text typed into the customer name field.
In the
src/Search.jsfile, declare a new state variable namedsearchInputwith the corresponding setter functionsetSearchInput(hint: use the React functionuseState). The initial value of thesearchInputvariable can be an empty string. Add avalueproperty to the<input>tag that is set to the newsearchInputstate variable.Create a new function
handleSearchInputtaking aneventparameter. This function should use thesetSearchInputfunction to update the state variablesearchInputwith what the user typed in the input field. Finally, add aonChangeprop to the<input>tag that is set to the functionhandleSearchInput. Useconsole.log()to output the value received in thehandleSearchInputfunction.Hint: Use
event.target.valueto get the input value.Test: