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 #28

Open
3 tasks done
kayali436 opened this issue Feb 27, 2024 · 0 comments
Open
3 tasks done

Feature Search State #28

kayali436 opened this issue Feb 27, 2024 · 0 comments

Comments

@kayali436
Copy link
Owner

kayali436 commented Feb 27, 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
@kayali436 kayali436 moved this from 📋 Backlog to 🔖 Ready in CYF Hotel React Module Project Feb 28, 2024
@adniyaYousaf adniyaYousaf self-assigned this Feb 28, 2024
@kayali436 kayali436 moved this from 🔖 Ready to 🏗 In progress in CYF Hotel React Module Project Feb 28, 2024
@adniyaYousaf adniyaYousaf moved this from 🏗 In progress to 👀 In review in CYF Hotel React Module Project Mar 1, 2024
@kayali436 kayali436 moved this from 👀 In review to ✅ Done in CYF Hotel React Module Project Mar 2, 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