How to create a TypeScript React app?
To create a TypeScript React app, you need to get familiar with the tools available under the hood. Not only is TypeScript a really great way to write JavaScript, but it also provides developers with runtime support to create a TypeScript React app. TypeScript is a superset of JavaScript and has been developed by Microsoft in collaboration with several companies such as Facebook, Google, and Twitter.
npx create-react-app my-app --template typescript
or
yarn create react-app my-app --template typescript
It provides developers with an option to program in a strongly-typed language that compiles to JavaScript at runtime so that JavaScript developers can use it without any change in their application.
This tutorial helps you in understanding how the TypeScript React app can be created easily.
To create typescript version
npx create-react-app my-app --template typescript
# or
yarn create react-app my-app --template typescript
NodeJS and NPM
Setting up a TypeScript React app is not as complicated as it may appear. There are some tools that you will need to install, but once installed it can be done in a few minutes. Let’s explore how!
The first step in building React native apps is to install some tools, including NodeJS and NPM. This guide aims to guide you through that process step-by-step and help you set up your local development environment so you can go ahead with the next steps: setting up a React project and creating a library component in TypeScript