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 \
  @types/react-router-dom

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

0 Shares
>