@baobaozhua Interesting! I'll think about an article on that subject then, thanks for the suggestion.
In the meantime this article dives deep into that subject if you want to read up on it now :) https://t.co/Cqw3lCXVHN
"React & TypeScript: how to type hooks (a complete guide)" by @PierreOuannes goes over how to type common React hook, along with a few bonuses like how to type forwardRef and how to type custom hooks
https://t.co/LZMWRntioS
🧵 React & TypeScript: how to type hooks
@PierreOuannes 's post is a good intro on how to type React hooks with TypeScript
Covering various TS features: inference, discriminated union types, type guards...
https://t.co/ka0C1D7jIR
5/ React & TypeScript: use generics to improve your types by @PierreOuannes
Good intro to generics
Analysis of the useState TS signature
Ends with a generic <Select> comp working with string or number
https://t.co/vsF9g7Qpae
6/ Use useReducer hook like a pro by @PierreOuannes
A deep dive on the useReducer hook
Introducing the basics
Explains when to use it over useState
Compare with Redux
https://t.co/tfYCfb6siw
Using form state as examples