Create a React app
Applies to: Visual Studio Visual Studio for Mac Visual Studio Code
In this 5-10 minute introduction to the Visual Studio integrated development environment (IDE), you create and run a simple React frontend web application.
Make sure to install the following:
- Visual Studio 2022 or later. Go to the Visual Studio downloads page to install it for free.
- npm (https://www.npmjs.com/), which is included with Node.js
- npx (https://www.npmjs.com/package/npx)
Create your app
In the Start window (choose File > Start Window to open), select Create a new project.
Give your project and solution a name.
Please note that creation of the React project takes a moment because the create-react-app command that runs at this time also runs the npm install command
View the project properties
The default project settings allow you to build and debug the project. But, if you need to change settings, right-click the project in Solution Explorer, select Properties, and then go the Build or Debugging section.
launch.json stores the startup settings associated with the Start button in the Debug toolbar. Currently, launch.json must be located under the .vscode folder.
Build Your Project
Choose Build > Build Solution to build the project.
Start Your Project
Press F5 or select the Start button at the top of the window, and you'll see a command prompt:
- npm running the react-scripts start command
Check console output for messages, such as a message instructing you to update your version of Node.js.
Next, you should see the base React app appear!
For ASP.NET Core integration: