|
|
|
|
|
by kall
1696 days ago
|
|
I think the way the docs introduce functional components (destructure the props argument right away) sets you up for success with TypeScript. The main ways to get started that they recommend (CodeSandbox, CRA, next.js) let you add typescript down the line with no hassle, so you don't loose out by starting without it. Seems better to teach people one thing at a time. React with TypeScript really doesn't look all that different and if you just drop what they teach you into an existing TS project, it will work ok. An official "Using React with Typescript" doc that shows good patterns for typing props and state would be nice though. |
|
https://react-typescript-cheatsheet.netlify.app/
But yes, I'd love to have some of this info added to the official docs as well.