CodeYourFuture / CodeYourFuture/React-Module-Project

Feature Search State

オープン
#17 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
🐂 Size Medium 📅 Week 3 🧩 Feature
主要言語
JavaScript
スター
1
フォーク
28
PR マージ指標
30日以内にマージされた PR はありません

説明

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 `` 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 `` 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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。