Add typescript to your React project

If you’re working with a Create React App (CRA) and you want to add typescript to it, run the following command:

yarn add \
  typescript \
  @types/node \
  @types/react \
  @types/react-dom \

Now, change the file you want to use typescript in to have the extension .tsx

Click Here to Leave a Comment Below

Leave a Reply: