Setting Up React Environment

In the last lesson, How React Works, you saw what React does when your app runs. Now let’s get your computer ready to build with it, one tool at a time.

🤔 Why Set Up Tools First?

Here is the pain you want to avoid:

  • You find an exciting React tutorial, so you copy the first command.
  • Then the terminal says node: command not found.
  • Now you are stuck before you even start, right? That feels frustrating.

The fix is simple, so let’s get it out of the way:

  • We install the few tools React needs ahead of time.
  • Then when you create your first app in the next lesson, every command just works.

So what do we actually need? Only a small toolkit:

  • Node.js runs JavaScript on your computer and brings npm along with it.
  • A code editor is where you write and organize your code, and we will use VS Code.
  • A modern browser is where your app runs and where you find and fix problems.

That is the whole list. Let’s set up each one.

🟢 Step 1: Install Node.js (and npm)

So what is Node and why do you need it?

  • Node.js is a program that lets your computer run JavaScript outside the browser.
  • React’s tools are built in JavaScript, so you need Node to use them.
  • When you install Node, you also get npm for free.
  • npm stands for Node Package Manager. Think of it like an app store for code, so it downloads React and other code packages your project needs.
  1. Download the installer

    Go to nodejs.org and download the LTS version. LTS means Long-Term Support. That is the stable version most people should use.

  2. Run the installer

    Open the file you downloaded and click through the steps. Keep the default options. The installer adds both Node.js and npm to your system.

  3. Check that it worked

    Open your terminal. That is Command Prompt or PowerShell on Windows, or Terminal on Mac. Then run these two commands.

    Terminal window
    node -v
    npm -v

    Each command prints a version number. That is how you know the install succeeded.

    Output

    v20.11.1
    10.2.4

    Your numbers may be a little different, and that is fine. As long as you see version numbers and not an error, you are ready.

Tip

If node -v or npm -v shows an error after installing, close your terminal completely and open a new one. The terminal only picks up newly installed tools when it starts fresh.

💻 Step 2: Install a Code Editor

So why use a proper editor instead of any text app?

  • A code editor is the program where you write your code.
  • You could use any text editor, but a real code editor adds color highlighting, smart suggestions, and error warnings as you type. That makes everything easier.

We will use VS Code (Visual Studio Code), and here is why it is a safe pick:

  • It is free.
  • It works on Windows, Mac, and Linux.
  • Most React developers use it, so help is easy to find.
  1. Download VS Code

    Go to code.visualstudio.com and download the version for your operating system. Install it like any other app.

  2. Open the Extensions panel

    Start VS Code. On the left side there is a sidebar. Click the Extensions icon. It looks like four small squares. You can also press Ctrl+Shift+X on Windows, or Cmd+Shift+X on Mac.

  3. Add two helpful extensions

    In the search box, find and install these. They are small add-ons that make writing React faster.

Here are the two extensions worth installing right away.

Extension What it does for you
ES7+ React/Redux/React-Native snippets Lets you type a short shortcut like rafce and get a full component written for you. Saves a lot of typing.
Prettier — Code formatter Cleans up your spacing and indentation automatically every time you save. Your code stays neat without effort.

Note

You do not need a long list of extensions to start. These two cover the common needs. You can always add more later as you find things you wish your editor did.

🌐 Step 3: Use a Modern Browser with React DevTools

Your React app runs in the browser, so you will spend a lot of time there. Here is what to know:

  • Any modern browser works well. Chrome, Firefox, or Edge are all good choices.
  • If you already have one of these, you are set.

There is one extra tool that makes React much nicer in the browser:

  • It is called React Developer Tools, a free browser extension.
  • It lets you look inside your React app while it runs.
  • So you can see each component, check its data, and find problems faster.
  1. Install the extension

    Search for React Developer Tools in your browser’s extension store. That is the Chrome Web Store, or Firefox Add-ons. Click add, and it installs in a few seconds.

  2. Find it later

    Once you have a React app running, open the browser’s developer tools by pressing F12. You will see new tabs called Components and Profiler. Those come from React DevTools.

Tip

The Components tab shows your app as a tree of components, just like the structure you write in code. When something on the page looks wrong, this is usually the first place to check.

⚠️ Common Mistakes

A few small things trip people up at this stage. Watch out for these.

  • Installing the wrong Node version. Grab the LTS build, not the one labeled “Current”. Current is for testing new features and can be less stable.
  • Forgetting to restart the terminal. If node -v fails right after installing, open a brand new terminal window. The old one does not know about Node yet.
  • Skipping React DevTools. Without it, you debug by guessing. With it, you can see exactly what each component is doing.
  • Installing too many extensions at once. It is tempting to add everything. Start with the two above so your editor stays simple and fast.

✅ Best Practices

  • Stick with the LTS version of Node so your setup stays stable.
  • Turn on Prettier’s Format on Save in VS Code settings so your code is tidied every time you save.
  • Keep one main browser for development so your DevTools and extensions are always in the same place.
  • Run node -v and npm -v whenever something feels broken. It is a fast way to confirm your tools are still there.

🧩 What You’ve Learned

Node.js runs JavaScript on your computer, and installing it gives you npm, the package manager that downloads React.

✅ You can confirm the install worked by running node -v and npm -v and seeing version numbers.

VS Code is a free, popular editor, and the ES7 React snippets and Prettier extensions make writing React faster and neater.

✅ A modern browser plus React Developer Tools lets you look inside your running app and debug it with confidence.

Check Your Knowledge

Test what you learned. Pick an answer for each question, then click Check.

  1. 1

    What do you get automatically when you install Node.js?

    Why: Installing Node.js also installs npm, which downloads React and other code packages for your projects.

  2. 2

    Which command checks that npm is installed and shows its version?

    Why: Running npm -v prints the installed npm version, confirming it is set up correctly.

  3. 3

    Why do we install React Developer Tools in the browser?

    Why: React Developer Tools adds Components and Profiler tabs so you can see and debug your running app.

  4. 4

    Which version of Node.js should a beginner install?

    Why: The LTS (Long-Term Support) version is the stable choice most people should use.

🚀 What’s Next?

Your computer is now ready, so it is time to build something real. In the next lesson we will use these tools to create and run an actual React project.

Creating Your First React App

Share & Connect