ES6 for React — Complete Guide
ES6 for React — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of React.js Tutorial on Toolliyo Academy.
On this page
React.js Tutorial · Lesson 5 of 100
ES6 for React
Beginner → Intermediate → Advanced → Professional
Beginner · 1 — Learn by example · ~6 min · Module 1: React Basics & Setup
What is this?
React code uses modern JavaScript: const/let, arrow functions, destructuring, spread (...), modules (import/export), and async/await for APIs.
Why should you care?
Every React tutorial and job interview assumes you know these basics. They make components shorter and easier to read.
See it live — copy this example
Paste into src/App.jsx (or the file noted in the steps). Save and watch the browser update.
const user = { name: 'Asha', role: 'admin' };
const { name, role } = user;
const greet = (n) => `Hello, ${n}`;
const more = { ...user, role: 'editor' };
console.log(greet(name));
console.log(more);
Run Example »
Edit the code and click Run to see the result update live.
What happened?
- Destructuring pulls fields from objects.
- Arrow functions define components and handlers.
- Spread copies objects when updating state immutably.
Try it yourself
- Practice destructuring props: function Card({ title, price }) { ... }
- Use import/export between files.
- Replace .then() chains with async/await in fetch examples.
- Change text or labels in the example and save — watch the browser update.
- Break the code on purpose (remove a bracket), read the error message, then fix it.
Remember
Know: const, arrow functions, destructuring, spread, import/export, async/await. React components are just JavaScript functions.