What is it good for?
Add a search input and use useEffect to implement a debounce on the pokemon list as a filter.
Add a search input and use useEffect to implement a debounce on the pokemon list as a filter.
Use setTimeout & clearTimeout to build a delay
SearchPanel.tsx
ListPage.tsx
ListPage.tsx
We can reuse a concrete Hook logic by extracting it into a custom Hook .
The logic to be extracted can use a single or multiple Hooks.
We simply move the logic into its own function.
In the component we just call this function.
Stick to the Hooks naming convention: use*
Extract the debounce logic for the search into a custom Hook.
usePokeList.ts
List.tsx
We learned…