Adding React and TypeScript
Continuing from the last lesson, we are going to add both React and TypeScript to our project in this lesson. We'll also create the root React component as well.
We'll cover the following...
Adding React #
We can install React into our project by running the following command in the terminal:
npm install react react-dom
This installs the core React library as well the React library for interacting with the browser.
Adding TypeScript #
TypeScript can be installed in our project as a development dependency by running the following command in the terminal:
npm install --save-dev typescript
Why do you think we have installed TypeScript as a development dependency rather than a full dependency that is available at runtime?
TypeScript is configured with a file called tsconfig.json
. Let’s create this file in the root of our project with the following content: