Using TypeScript with React


React has TypeScript support so you all you need to do is just run your normal create React app command with the TS template flag

npx create-react-app <app-name> --template typescript

Counter example

For my example I will be building out a simple counter app. After the React boilerplate is finished installing, I created a a component folder within the src directory and created two components( Count.tsx & Counter.tsx) and replaced the React boilerplate code in the App.tsx with my code.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Steven Wu

Steven Wu

I’m a NYC based full stack developer and a part-time gaming nerd