The JavaScript ES6 features to learn before React are let/const, arrow functions, template literals, destructuring, the spread operator, map()/filter()/find(), default parameters, modules, async/await and optional chaining. React adds very little syntax of its own. Most of what looks strange inside a component is plain modern JavaScript.
That's why so many beginners stall a few lessons into a React tutorial. The instructor writes const [count, setCount] = useState(0), says "just destructure the props", drops a .map() into the JSX and moves on. If those pieces are new to you, React gets the blame for what is really a JavaScript gap.
You don't need to master all of JavaScript first. You need these ten features, and you need to recognise them on sight.
Quick reference: what each feature does in React
| Feature | What it does | Where you'll see it in React |
|---|---|---|
| let / const | Declares variables with block scope | Every component, every hook |
| Arrow functions | Shorter function syntax | Components, event handlers |
| Template literals | Puts variables inside strings | Dynamic class names, API URLs |
| Destructuring | Pulls values out of objects/arrays | Props, useState |
| Spread (...) | Copies and merges arrays/objects | Updating state |
| map / filter / find | Transforms and searches arrays | Rendering lists, search |
| Default parameters | Fallback values for arguments | Default prop values |
| import / export | Splits code across files | Every component file |
| async / await | Handles data that arrives later | Fetching API data |
| Optional chaining (?.) | Reads nested data safely | Data that isn't loaded yet |
A quick note on naming: ES6 is the 2015 release of JavaScript. async/await arrived in ES2017 and optional chaining in ES2020, so "ES6+" is the honest label. Every React tutorial uses them, which is why they're on this list.
1. let and const: which one should you use?
Before ES6, everything was declared with var. Its function-level scope and hoisting behaviour cause bugs that are hard to spot, so modern code avoids it.
let username = "Alex"; username = "John"; // fine const age = 24; // age = 25; // TypeError: Assignment to constant variable -
const: your default. Use it whenever you won't reassign the variable. -
let: use it only when the value genuinely needs to change. One thing that trips people up:conststops reassignment, not changes inside an object or array.
const user = { name: "Alex" }; user.name = "Sam"; // allowed In React: const [count, setCount] = useState(0); combines const with array destructuring in a single line. You'll write it hundreds of times.
2. Arrow functions: why are there arrows everywhere?
Arrow functions are a shorter way to write functions.
// Traditional function function greet() { return "Hello World"; } // Arrow function const greetArrow = () => { return "Hello World"; }; // Implicit return (one expression, no braces) const greetShort = () => "Hello World"; A classic beginner bug: const greet = () => { "Hello World" }; returns undefined. Once you add curly braces, you need return.
In React: components are often written as arrow functions, and event handlers almost always are: onClick={() => setCount(count + 1)}.
3. Template literals: how do you put variables inside strings?
Template literals use backticks and ${} instead of + concatenation.
const name = "Alex"; // Old approach const message = "Hello " + name + "!"; // ES6 approach const greeting = `Hello ${name}!`; In React: you'll use them for dynamic class names, like className={`btn ${isActive ? "active" : ""}`}, and for building API URLs.
4. Destructuring: how do you pull values out of objects and arrays?
Destructuring extracts values in one line instead of several.
const user = { name: "Alex", age: 24 }; // Without destructuring const userName = user.name; const userAge = user.age; // With destructuring const { name, age } = user; // Arrays work by position const colors = ["Red", "Blue", "Green"]; const [first, second] = colors; // "Red", "Blue" In React: props arrive as an object, so most components destructure them straight away: function Profile({ name, age }) { ... }. And useState returns an array, which is why you see const [value, setValue].
5. Spread operator: how do you copy and combine data?
The spread operator (...) expands the items of an array or the properties of an object into a new one.
const firstList = [1, 2, 3]; const secondList = [...firstList, 4, 5]; console.log(secondList); // [1, 2, 3, 4, 5] const user = { name: "Alex", age: 24 }; const updatedUser = { ...user, city: "Mohali" }; The copy is shallow: nested objects inside it are still shared with the original.
In React: this is how you update state without mutating it, for example setUser({ ...user, city: "Mohali" }). Changing user.city directly and calling setUser(user) passes the same object back, and React may not re-render.
6. map(), filter() and find(): which array methods matter most?
These three come up constantly in React code.
// map(): returns a new array with every item transformed const numbers = [1, 2, 3]; const doubled = numbers.map((num) => num * 2); // [2, 4, 6] // filter(): returns every item that passes a condition const scores = [10, 20, 30, 40]; const high = scores.filter((score) => score > 20); // [30, 40] // find(): returns the first item that passes, or undefined const names = ["Alex", "John", "Sam"]; const match = names.find((n) => n === "John"); // "John" In React: map() is how lists get rendered. {students.map((s) => <li key={s.id}>{s.name}</li>)} turns an array of data into an array of elements, and each one needs a unique key. filter() powers search boxes and tabs; find() picks a single selected item.
7. Default parameters: how do you set fallback values?
A default parameter is used when no value (or undefined) is passed.
function welcome(name = "Guest") { return `Welcome, ${name}!`; } console.log(welcome()); // Welcome, Guest! console.log(welcome("Alex")); // Welcome, Alex! In React: default prop values work the same way inside destructuring: function Button({ label = "Submit" }) { ... }.
8. Modules: what do import and export actually do?
Modules let you split code into files and share only what you choose.
// math.js: named export export const add = (a, b) => a + b; // greet.js: default export (one per file) export default function greet() { return "Hello!"; } // app.js import { add } from "./math.js"; // named: curly braces, exact name import greet from "./greet.js"; // default: no braces, any name console.log(add(5, 3)); // 8 In React: every component file ends with an export, and every file starts with imports such as import { useState } from "react";. Mixing up named and default imports is one of the most common "why is this undefined?" errors.
9. Promises and async/await: how do you handle data that arrives later?
Calling an API takes time, so fetch() returns a Promise: a placeholder for a value that will arrive later. async/await lets you write that waiting in a top-to-bottom style that's easier to read.
async function getUsers() { try { const response = await fetch("https://jsonplaceholder.typicode.com/users"); if (!response.ok) throw new Error(`HTTP ${response.status}`); const data = await response.json(); console.log(data); } catch (error) { console.error("Could not load users:", error.message); } } getUsers(); Note that fetch() doesn't reject on a 404 or 500, which is why the response.ok check is there. await also only works inside an async function (or at the top level of a module).
In React: this is the pattern you'll use to load data, usually inside useEffect or through a data-fetching library.
10. Optional chaining (?.): how do you avoid "Cannot read properties of undefined"?
Optional chaining stops and returns undefined when part of a path is missing, instead of throwing an error.
const user = { name: "Alex", address: { city: "Mohali" }, }; console.log(user.address?.city); // "Mohali" console.log(user.contact?.phone); // undefined, no crash In React: on the first render your API data often hasn't arrived yet, so user?.address?.city keeps the component from crashing while it waits.
What mistakes do beginners make with these in React?
These are the ones that come up again and again when people move from JavaScript practice to their first components:
- Using curly braces in an arrow function and forgetting
return, so nothing renders. - Mutating state directly (
user.city = "Delhi") instead of creating a new copy with spread. - Leaving out the
keyprop inside.map(). - Writing
onClick={handleClick()}, which runs the function on every render, instead ofonClick={handleClick}. - Using
awaitoutside anasyncfunction.
What should you practice before starting React?
Reading examples helps, but writing the code yourself is what makes it stick. Try these:
- Rewrite five
vardeclarations usingletandconst. - Convert five traditional functions into arrow functions, including at least two with implicit returns.
- Create a student object and pull out its values with destructuring.
- Use
map()to turn an array of student names into strings like "Student: Alex". - Use
filter()to keep only the students who scored above 70. - Create two files and practice named and default imports between them.
- Fetch data from a free API with async/await, including error handling. If you can do all seven without checking a tutorial, you're ready to start React. For anything you get stuck on, MDN's JavaScript Guide is the most reliable reference.
How long should you spend on ES6 before React?
Less time than most people think. If you already know basic JavaScript (variables, functions, loops, objects), a week or two of daily practice on these ten features is usually enough to start. You don't need classes, prototypes or closures in depth on day one, because modern React is written with function components and hooks. Learn the rest as you hit it.
React gets much easier once these patterns stop feeling foreign. Which one confused you most when you started? Tell me in the comments.
Solitaire Infosystems is an IT training and software development company in Mohali. If you'd like structured, project-based practice, see our React JS training.