Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
This guide walks through setting up a React development environment directly on Windows using the Vite frontend tooling.
We recommend these instructions if you are new to React or building a project that does not need a Linux environment. If you plan to use Bash tooling extensively or deploy to a Linux server, consider installing React on WSL instead.
For background on React and the different scenarios — web apps, mobile apps (React Native), and native desktop apps (React Native for Desktop) — see the React overview.
Prerequisites
- Node.js: Required to run Vite and npm. Install using nvm-windows for easy version management.
Create your React app
Open a terminal (Windows Command Prompt or PowerShell).
Create a new project folder and enter it:
mkdir ReactProjects cd ReactProjectsCreate a new React app using Vite:
npm create vite@latest my-react-app -- --template reactVite will scaffold a new React project in the
my-react-appfolder.Navigate into the new app folder and install dependencies:
cd my-react-app npm installStart the local development server:
npm run devYour app will be available at
http://localhost:5173. Use Ctrl+C to stop the server.When you are ready to deploy, build a production bundle:
npm run buildOutput is placed in the
distfolder. See Deploying a Static Site for hosting options.
Note
Vite is ideal for single-page apps (SPAs). If you need server-side rendering or a Node.js backend, consider Next.js instead. For static site generation, see Gatsby.
Additional resources
Windows developer