Create a React + Typescript project with Vite
Summary
These days, npx create-react-app
is not enough to create a react project. There are plenty of ways to create the project but if you want to create a SPA (single page application) that supports typescript with blazing fast development experience, try Vite. Why? Take a look up here!
Prerequisites
- Make sure you have installed Node.js version 16+
Create Vite Project
Run the following command in the terminal.
npm create vite@latest
You’ll need to enter the project name like this.
After that, you’ll have to choose a framework that you want to use. In this case, we’ll choose React.
And then, choose Typescript.
And it’ll show like this. All you need to do is go to the project root folder and run npm install
.
Finally, run npm run dev
to serve as a local development.
Access Permission Error
If you encounter with the following problem, use sudo npm run dev
.
Done
That’s it. Go and write some code. Happy hacking :)