LearnContact
Lesson 520 min read

Prerequisites for React

Review the JavaScript, HTML, and CSS fundamentals you should be comfortable with before starting hands-on React development.

Introduction

React is a JavaScript library, which means React code is JavaScript code with some extra conventions layered on top. Before diving into components, props, and Hooks, it is worth making sure you are comfortable with the modern JavaScript features that show up constantly in React codebases, along with basic HTML and CSS.

This lesson is a checkpoint, not a full JavaScript course. It lists exactly what to review, explains why each piece matters specifically for reading and writing React, and gives you a short self-check so you can gauge your own readiness before moving on.

What You Will Learn
  • The core JavaScript features used constantly in React code.
  • Why these specific fundamentals matter for reading React.
  • The basic HTML and CSS knowledge you should already have.
  • A self-check to confirm you are ready to move forward.

Why Fundamentals Matter for React

React does not introduce a new programming language — everything inside a component is regular JavaScript, wrapped in a function and returning some JSX. If a piece of JavaScript syntax feels unfamiliar, it will slow you down when reading React examples, even if the React-specific concept (like a Hook) is simple.

The good news is that the list of JavaScript features you need is short and specific. You do not need to be a JavaScript expert — you just need to be comfortable with the handful of patterns that appear over and over again in React code.

JavaScript Fundamentals to Know

These are the JavaScript features you will see constantly once you start writing React components.

Variables (let, const)

React code almost always uses let and const instead of var, especially for state and props.

Functions & Arrow Functions

Components are functions, and event handlers are usually written as arrow functions like () => { ... }.

Array Methods (map, filter)

Rendering lists of data in React relies heavily on array.map(), often combined with .filter().

Destructuring

Props and state are frequently unpacked using object and array destructuring, e.g. const { name } = props.

Template Literals

Backtick strings let you embed variables directly inside text using the ${title} syntax, e.g. `Hello, ${name}!`.

ES6 Modules (import/export)

Every component typically lives in its own file, imported and exported with import and export.

Two more features are worth calling out specifically: the spread operator (...) and the rest operator, which look identical but serve different purposes depending on context.

Spread Operator

Copies values out of an array or object, e.g. const newArr = [...oldArr, newItem] — common when updating state without mutating it.

Rest Operator

Gathers remaining values into a single variable, e.g. function Card({ title, ...rest }) — common when passing along extra props.

Basic HTML and CSS Knowledge

Since JSX closely resembles HTML, you should be comfortable with common HTML elements (div, span, ul, li, form, input, button) and basic attributes (class, id, href, src). You do not need to be an HTML expert, but recognizing standard tags will make JSX far easier to read.

Basic CSS knowledge — selectors, the box model, flexbox basics, and how classes apply styles — is also useful, since React components are typically styled with CSS files, CSS Modules, or inline style objects, all of which build on the same core CSS concepts.

Why This Matters

JSX looks like HTML but behaves like JavaScript. Knowing standard HTML tags and basic CSS means you can focus on learning what is different about JSX, instead of learning markup and React at the same time.

Example: Reading React-Style Code

Here is a small snippet that uses several of the fundamentals above together — destructuring, arrow functions, template literals, and array methods. You do not need to write code like this yet, just be able to follow it.

UserList.jsx
const users = [
  { id: 1, name: "Ava" },
  { id: 2, name: "Liam" },
];

function UserList({ title }) {
  return (
    <div>
      <h2>{`${title} (${users.length})`}</h2>
      <ul>
        {users.map((user) => (
          <li key={user.id}>{user.name}</li>
        ))}
      </ul>
    </div>
  );
}

export default UserList;
Rendered on the Page
Team Members (2)
- Ava
- Liam

Notice the destructured { title } parameter, the template literal building the heading text, and users.map() turning an array of data into a list of elements — all plain JavaScript features, used inside a React component.

Common Mistakes

Avoid These Mistakes
  • Jumping into React without being comfortable with arrow functions or destructuring, then struggling to follow basic examples.
  • Confusing the spread operator and rest operator just because they look the same (...) — context determines which one you are looking at.
  • Assuming you need to master every advanced JavaScript feature before starting — only the fundamentals listed here are truly essential up front.
  • Skipping HTML/CSS review entirely, then getting stuck on JSX syntax that is actually just standard HTML markup.

Best Practices

  • Practice writing a few functions using arrow syntax and destructuring before starting React.
  • Get comfortable with array.map() specifically, since it is the standard way to render lists in React.
  • Review basic HTML tags and CSS selectors if it has been a while since you used them.
  • Do not wait for "perfect" JavaScript mastery — you can learn remaining details alongside React itself.
  • Keep the MDN Web Docs handy as a reference for any JavaScript syntax that feels unfamiliar.

Self-Check: Are You Ready?

Quick Readiness Quiz
  • Can you write a function using arrow syntax, e.g. const add = (a, b) => a + b;?
  • Can you destructure a value out of an object, e.g. const { name } = person;?
  • Do you know what array.map() does and how it returns a new array?
  • Can you use a template literal to embed a variable in a string?
  • Do you know the difference between import and export in ES6 modules?
  • Are you comfortable with common HTML tags like div, ul, li, and button?
  • If you answered yes to most of these, you are ready to move on to setting up your React environment.

Frequently Asked Questions

Do I need to be a JavaScript expert before learning React?

No. You need to be comfortable with core fundamentals — variables, functions, destructuring, array methods, template literals, and ES6 modules — not every advanced JavaScript feature.

What if I do not know the spread or rest operator well?

Spend a little time practicing both, since they appear frequently in React code for copying state and passing along extra props, but you can also pick them up gradually as you encounter them.

Do I need to know CSS frameworks like Bootstrap before learning React?

No. Basic CSS knowledge is enough to start. Specific styling approaches, including frameworks, are covered later in this course.

Can I learn JavaScript and React at the same time?

It is possible, but slower and more frustrating, since you would be learning two things at once. Reviewing the fundamentals in this lesson first will make the rest of the course much smoother.

What is the single most important fundamental for React?

Comfort with functions (especially arrow functions) and destructuring stands out, since nearly every component and prop pattern in React relies on both.

Key Takeaways

  • React code is JavaScript, so strong fundamentals make React much easier to read and write.
  • Key features to know include variables, functions/arrow functions, array methods like map and filter, destructuring, template literals, and ES6 modules.
  • The spread and rest operators look identical but serve different purposes depending on context.
  • Basic HTML and CSS knowledge helps because JSX closely resembles HTML markup.
  • A quick self-check against these fundamentals can confirm you are ready to start setting up a React environment.

Summary

React builds directly on core JavaScript, HTML, and CSS knowledge rather than replacing it. Being comfortable with modern JavaScript syntax — arrow functions, destructuring, array methods, template literals, and modules — along with basic markup and styling, means you can focus on what is genuinely new in React instead of getting stuck on familiar syntax.

In this lesson, you reviewed the JavaScript, HTML, and CSS fundamentals that matter most for React, saw them used together in a short example, and checked your own readiness. Next, you will set up your local development environment and get ready to build your first React app.

Lesson 5 Completed
  • You know the core JavaScript fundamentals React code relies on.
  • You understand why these fundamentals matter specifically for React.
  • You have basic HTML and CSS knowledge in place.
  • You are ready to set up your React development environment.
Next Lesson →

Setting Up React Environment