Getting Started with TypeScript in React
TypeScript can be used with React.js, just like JavaScript can and is. As TS is a superset of JavaScript, there is, depending on compiler options, no need to actually use TypeScript features. In the following, we’ll have a look at unique parts of TSX and how to get started.
TypeScript in create-react-app
Section titled “TypeScript in create-react-app”There are two ways to get started:
yarn create react-app my-app --template typescriptor:
yarn create react-app my-app --template typescriptTypeScript in Next.js
Section titled “TypeScript in Next.js”For Next.js, there are also two ways of getting started:
npx create-next-app@latest --tsor:
yarn create react-app my-app --template typescript