Facebook Pixel

From Episode 1 to Episode 2: Setting Up Your Real React App

Episode 2 is where you set up a real React project with npm and a bundler. Here is a roadmap to make the transition smoothly.

From Episode 1 to Episode 2: Setting Up Your Real React App

Episode 1 taught you React via CDN. Episode 2 moves you to a real project setup with npm, a bundler, and a proper file structure. This transition trips up many beginners. Here is a roadmap to make it clean.

Step 1: Install Node.js and Verify npm

Before anything else, install Node.js LTS and verify npm works from your terminal. Without this, none of the following steps work.

Step 2: Initialize the Project

Create a project folder and run npm init to generate a package.json, or use a starter that sets it up for you. This file is the manifest for everything that follows.

Step 3: Install React and ReactDOM

Install react and react-dom as dependencies. These are the core packages your app needs to run.

Step 4: Add a Bundler

Install Parcel (or Vite) as a devDependency. Configure an npm script to start the dev server so you can run your app locally.

Step 5: Create an Entry Point

Create an index.html and a JavaScript entry file, typically src/index.js. Mount your React app to a root element using createRoot.

Step 6: Set Up a Basic Structure

Create components and utils folders. Keep it minimal. Structure grows with the project; do not over-organize on day one.

Step 7: Add Git and .gitignore

Initialize Git and add node_modules to .gitignore. Commit your work. This protects you and builds a history.

The Common Mistake

Learners try to add styling, linting, testing, and routing all in Episode 2. That is too much at once. Get the app running first, then layer tools as the course introduces them.

The Takeaway

Episode 2 is about turning React from a CDN script into a real project. Follow the steps in order, keep it minimal, and add complexity only when the next episode requires it.

Install Node.js, initialize a project with package.json, install react and react-dom, add a bundler like Parcel as a devDependency, create an index.html and JavaScript entry, and mount your app with createRoot.

Install Node.js LTS first and verify npm works. Then initialize the project to create package.json. After that, install react and react-dom as dependencies and add a bundler as a devDependency.

No. That is too much at once. Get the app running first with React, ReactDOM, and a bundler. Add styling, linting, testing, and routing only when later episodes introduce them.

To exclude node_modules and other generated files from Git. node_modules is large and reproducible from package.json, so committing it bloats the repository and causes avoidable merge conflicts.

Very minimal. A components folder, a utils folder, and an entry file are enough. Structure should grow with the project; creating many empty folders on day one adds confusion without value.

Ready to master React completely?

Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course to dive deeper with high-quality video tutorials, solve interview questions, and a premium community.

Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.