👋 This repo is maintained by @swyx, @eps1lon and @filiptammergard. We're so happy you want to try out TypeScript with React! If you see anything wrong or missing, please file an issue! 👍
You can use this cheatsheet for reference at any skill level, but basic understanding of React and TypeScript is assumed. Here is a list of prerequisites:
React has documentation for how to start a new React project with some of the most popular frameworks. Here's how to start them with TypeScript:
There are some tools that let you run React and TypeScript online, which can be helpful for debugging or making sharable reproductions.
However, the general consensus today is that React.FunctionComponent (or the shorthand React.FC) is not needed. If you're still using React 17 or TypeScript lower than 5.1, it is even discouraged. This is a nuanced opinion of course, but if you agree and want to remove React.FC from your codebase, you can use this jscodeshift codemod.
React.FunctionComponent is explicit about the return type, while the normal function version is implicit (or else needs additional annotation).