Step-by-Step Guide to Installing and Running React.js Apps in VS Code
Learn how to install Node.js with NVM, set up a React.js app, and run it in Visual Studio Code. Follow these steps for a seamless setup.
File
How To Setup ReactJS In VSCode (Install And Run React JS App In Visual Studio Code) 2024
Added on 09/28/2024
Speakers
add Add new speaker

Speaker 1: In this quick tutorial, I'm going to show you how to install and run React.js apps in VS Code or Visual Studio Code. Now, once you open VS Code, go ahead and go to Terminal and create a new terminal. So go ahead and take the link from the description of this video and paste it directly into Terminal. Now, this is going to install Node.js using something called Node Version Manager or NVM. Now, if you're serious about web development, you do want to use the NVM instead of just downloading Node from its website because it will allow you to install multiple versions of Node.js and switch between them seamlessly. Now, after that's done, type source and again, just find this line in the description of this video. Paste it. Running this command will actually load NVM, but it actually might not work if you are on the latest Mac OS operating system. It might work on older OS, but let me just clear this. In case it doesn't work, use the Z shell instead. So again, this command is in the description of this video. Just run it here in the terminal. Now, to check if we have NVM installed, type nvm //version and if you see the correct version, which is 0.395, we are ready to create and install a React.js app in VS Code. But first, let's finish installing the latest version of Node.js with NVM. To do that, type nvm install //LTS and this is going to start installing the absolutely latest version of Node.js. And guys, don't forget to like this video. It helps the YouTube algorithm or even subscribe to my channel. Now, once Node.js is finished installing, type node //version and you should see the latest version. Now, I'm going to change directory to desktop and I think we are ready to create our first React.js app in VS Code. You don't have to do it on desktop. You can find a safer location on your hard drive and that's where you're going to type the next command, which will actually create the React app from the command line. This command is npm install –g create-react-app. This will install the create-react-app helper so we can create a React app from command line. Now, the way it works is that we're going to call npx command followed by create-react-app and name the folder of your React app anything you want. Here, I'm just going to use my-app but it's really up to you what you want to call that folder for your React project in VS Code. Now, at this point, your React.js app has been actually installed and set up in VS Code so we're going to switch to the my-app folder or whatever you named your React.js app and we're going to call npm start and that's it guys. This is how you launch a React.js app in your browser but there's one more thing. How do we actually open this React.js app for editing in Visual Studio Code or VS Code? Now, open new VS Code editor, go to terminal, navigate to the app folder which was desktop my-app and to open the current folder you're in on the command line, type code space dot and press enter. Now, ideally, this will open this project in Visual Studio Code but if it's not opening, press ctrl shift p which opens the command palette in VS Code. Start typing the word shell and then click on shell command, install code, command in path. Here, just click okay, then just enter your macOS password, click okay to add code to the path, go back to terminal and make sure you are in your current project folder and type code space dot and press enter. Now, your React.js project will open in VS Code in a new window so here under source you have your app.js file which is the main application file for your React app and that's it guys. Now, just go to the folder in terminal and type npm start to start your React.js from Visual Studio Code. Now, this already supports hot reload so whenever you change something in VS Code, it's going to automatically change in the browser. If this tutorial helped you, like this video and subscribe to my channel.

ai AI Insights
Summary

Generate a brief summary highlighting the main points of the transcript.

Generate
Title

Generate a concise and relevant title for the transcript based on the main themes and content discussed.

Generate
Keywords

Identify and highlight the key words or phrases most relevant to the content of the transcript.

Generate
Enter your query
Sentiments

Analyze the emotional tone of the transcript to determine whether the sentiment is positive, negative, or neutral.

Generate
Quizzes

Create interactive quizzes based on the content of the transcript to test comprehension or engage users.

Generate
{{ secondsToHumanTime(time) }}
Back
Forward
{{ Math.round(speed * 100) / 100 }}x
{{ secondsToHumanTime(duration) }}
close
New speaker
Add speaker
close
Edit speaker
Save changes
close
Share Transcript