|
|
|
|
|
by littlecranky67
2719 days ago
|
|
Hooks are a big deal if you use TypeScript with React. Explicitly typing the state is gone (it will be inferred by what you pass as initial value to useState()). So is weird Partial<TState> typings when setting the initial class state in the constructor or via this.setState(). And if you ever had to deal with correctly typing HOCs or render props you had to dig very deep into conditional/mapped types in TS. With hooks this is basically gone. |
|
I think hooks might be nice for data fetching when it comes to TS as it will super easy to get typing.
I'm still not convinced by hooks though.