How to Install and Set Up React with Vite and TypeScript (Step by Step)

Thirdy Gayares

Thirdy Gayares

Author

In this article, I will show you how to set up a React project using Vite and TypeScript step by step. This guide is perfect for beginners who want to start using React with TypeScript in a fast and efficient way. By the end, you will have a working project that is ready for development.

Important Note

Before starting, make sure you have Node.js installed on your machine. Vite requires Node.js to run. You can download and install it from the official website: https://nodejs.org/.

1. Create a Vite + React + TypeScript Project

Run the following command in your terminal:

npm create vite@latest my-new-app --template react-ts
1. Create a Vite + React + TypeScript Project

Choose React:

2. Choose React

Choose Typescript:

3. Choose TypeScript

Then, go into the project folder:

cd my-new-app
4. Go to the Project

2. Install Dependencies

Run:

npm install
5. Install Dependencies

3. View Source Code on your favorite IDE

View Source Code on your favorite IDE

4: Run your code

Run:

npm run dev
Run your code

Your React + Vite + TypeScript project is now ready!

React Setup Output
Do you have any comments or suggestions?