Course lesson
Create a Custom Hook in React by Wrapping useState
Custom hooks in React are functions, and we can write them by combining other, preexisting hooks.
- Duration
- 2 min
- Access
- Free
- Transcript
- Needs source
Custom hooks in React are functions, and we can write them by combining other, preexisting hooks.
In this lesson, we'll wrap the useState React hook to create a hook that automatically pulls out the event.target.value of an input's onChange callback. We'll then use that hook directly as the onChange prop of a text input.