Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Search State #21

Open
3 tasks
RbAvci opened this issue Feb 24, 2024 · 0 comments
Open
3 tasks

Feature Search State #21

RbAvci opened this issue Feb 24, 2024 · 0 comments

Comments

@RbAvci
Copy link
Owner

RbAvci commented Feb 24, 2024

From React-Module-Project created by SallyMcGrath: CodeYourFuture#17

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.js file, declare a new state variable named searchInput with the corresponding setter function setSearchInput (hint: use the React function useState). The initial value of the searchInput variable can be an empty string. Add a value property to the <input> tag that is set to the new searchInput state variable.

Create a new function handleSearchInput taking an event parameter. This function should use the setSearchInput function to update the state variable searchInput with what the user typed in the input field. Finally, add a onChange prop to the <input> tag that is set to the function handleSearchInput. Use console.log() to output the value received in the handleSearchInput function.

Hint: Use event.target.value to get the input value.

Test:

  • Given a searchInput
  • When I type in the field
  • Then the value is logged
@RbAvci RbAvci moved this to 📋 Backlog in React Module Project Mar 9, 2024
@zelihapala zelihapala moved this from 📋 Backlog to 🏗 In progress in React Module Project Mar 11, 2024
@zelihapala zelihapala moved this from 🏗 In progress to 👀 In review in React Module Project Mar 15, 2024
@RbAvci RbAvci moved this from 👀 In review to ✅ Done in React Module Project Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants