Created
July 18, 2019 17:53
-
-
Save toxi-kb/c2abd17a72f697054592422db7fa399d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState, useCallback } from "react"; | |
| const SearchWithHooks = () => { | |
| const [search, setSearch] = useState(""); | |
| const onSearchInputChange = useCallback(e => { | |
| setSearch(e.target.value); | |
| }, []); | |
| return ( | |
| <input | |
| onChange={onSearchInputChange} | |
| type="text" | |
| name="search" | |
| placeholder="search with hooks" | |
| value={search} | |
| /> | |
| ); | |
| }; | |
| export default SearchWithHooks; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment