Course lesson

Type React Hooks using TypeScript

Previously, I added some type information for the utility function we are going to look at. By clicking on the function, a lightbulb appears. We can click that and select Annotate everything with types from JSDoc. Thanks to our plugin, it will type our...

Duration
6 min
Access
Included
Transcript
Retained from source evidence

Previously, I added some type information for the utility function we are going to look at. By clicking on the function, a lightbulb appears. We can click that and select Annotate everything with types from JSDoc. Thanks to our plugin, it will type our function for us. It's not always perfect so double check to make sure it's exactly as you would like.

Along with the utility function, we are going to look at how to type a useMemo hook, a useCallback hook, a useRef hook, a useState hook, and a custom hook.