Sunday, May 24, 2020

HelloWorld create-react-app Application using TypeScript

In the previous post we saw on how to setup a React Application using TypeScript and webpack, in that post we manually installed the required npm packages, created the config files and the React component files from scratch, this was a good way to know how React application builds and executes, but it takes time to do this setup.

In this post we will use the create-react-app package from Facebook to quickly create a React application using TypeScript.

Open a command prompt and run the following command.


> npx create-react-app@latest reactapp-ts --template typescript

npx create-react-app@latest
is the command
reactapp-ts is our project name
--template typescript is the switch which tells that we are going to use TypeScript in the App

When this command is executed, it will create a folder reactapp-ts and install all the necessary packages, config file and also a sample React Application in the folder, all in just a single command.

Run the npm start command, this will build the project and launch the application in the browser as follows.




Search Flipkart Products:
Flipkart.com

No comments: