Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for How to Set Up Your First React Project
Pavel Keyzik
Pavel Keyzik

Posted on • Originally published atpavelkeyzik.com

     

How to Set Up Your First React Project

Where to start?

There are too many ways to create the React application, we have a bunch of tools and frameworks that allow us easily set up our app. In this tutorial, I am going to useVite as it's the easiest way to set up basic React application that will work on the client side.

Another popular choice isNext.js framework that's built on top of React and adds a lot of useful things you might want to have in the future, but if you are starting to learn React, you might not need them until you understand how React works and what problems you could solve by usingNext.js

Before you can create an application with Vite, you need to installNode.js this thing is must in modern web development. Just go to theNode.js website and download latest version. To make everything installed correctly, run this command in terminal:

node--version# You should see some version, for example v21.5.0
Enter fullscreen modeExit fullscreen mode

Another thing you’ll need is code editor. I personally use VSCode, it’s free, open source and probably one of the most popular choice for web development.

Create the Base Application

Now, let’s open the terminal and go to any folder where you’d like to store your React project and run the command below.

In the code below, I use the template react-ts; this tells Vite to create a React application withTypeScript. If you don’t want using TypeScript, you could replacereact-ts withreact.

CheckoutVite docs for all available templates

npm create vite@latest my-app-name----template react-ts
Enter fullscreen modeExit fullscreen mode

This will create a folder structure and generates all files we need. Now, let’s open the folder, install all dependencies, and finally run our project:

cdmy-app-namenpminstallnpm run dev
Enter fullscreen modeExit fullscreen mode

You should now see in terminal a URL to the application. By default, it’shttp://localhost:5173/, so let’s open it in browser and I hope you see same page as me.

The expected result in the browser

Now you should be able to opensrc/App.tsx or (src/App.jsx if you decided not to use TypeScript) and you could see change the HTML-like code, save file and it’ll automatically rebuild this code and you’ll see updates in browser. Have fun here ☺️

What's next?

Now you can go toQuick Start – React and learn more about the React itself. I don’t have any plans to teach React, because React docs are perfect to learn about React. See you in the next article where I’m going to add more configuration to make my development experience a bit better 😄

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Front-end developer
  • Location
    Poland
  • Work
    Software Engineer
  • Joined

More fromPavel Keyzik

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp