3 ms·
Do hooks work well with TypeScript? e.g. types will catch errors for you and you don't need to use "any"
by seanwilson 8y ago
Do hooks work well with TypeScript? e.g. types will catch errors for you and you don't need to use "any"
- gcommer 8y agoSure, the "magic" bit of hooks that people are talking about doesn't really affect their type signature See eg, setState: `function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>];` from: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/ab0806bfb5b2ad74dccacd4780be688e96d2ea5a/types/react/index.d.ts#L809 https://github.com/DefinitelyTyped/DefinitelyTyped/blob/ab08...