React Props — Complete Guide
React Props — 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 11 of 100
Modern JavaScript
Beginner → Intermediate → Advanced → Professional
Beginner · 1 — Foundations · ~12 min read · Module 2: JavaScript & React Fundamentals
Introduction
This lesson is part of the beginner section. We explain Modern JavaScript slowly, with examples you can copy and run. If something is unclear, read it twice — that is how everyone learns. React code uses modern JavaScript: const/let, arrow functions, destructuring, spread (...), modules (import/export), and async/await for APIs. Every React tutorial and job interview assumes you know these basics. They make components shorter and easier to read.
Modern JavaScript appears in almost every file you will write. Once it clicks, later lessons (hooks, routing, APIs) become much easier.
When will you use this?
You use this in every component you write from your first app to your tenth year on the job.
- Product pages, login forms, and todo lists all use components, props, and state.
- When a user types in a search box, React state holds the text and filters a list.
Real-world: destructuring API responses
Swiggy order tracking API returns nested JSON. Modern JS destructuring keeps component code readable when pulling status, rider name, and ETA.
Production-style code
async function fetchOrder(orderId) {
const res = await fetch(`/api/orders/${orderId}`);
const { id, status, rider: { name: riderName }, etaMinutes } = await res.json();
return { id, status, riderName, etaMinutes };
}
function OrderTracker({ orderId }) {
const [order, setOrder] = useState(null);
useEffect(() => {
fetchOrder(orderId).then(setOrder);
}, [orderId]);
if (!order) return <p>Locating your order…</p>;
return (
<p>{order.status} — {order.riderName} arrives in {order.etaMinutes} min</p>
);
}
What happens in production: Arrow functions, const, destructuring, and async/await appear in every React file — this is daily syntax, not academic trivia.
Lesson example (start here)
Copy this smaller example first. Once it works, compare it with the real-world code above.
const user = { name: 'Asha', role: 'admin' };
const { name, role } = user;
const greet = (n) => `Hello, ${n}`;
const more = { ...user, role: 'editor' };
Line-by-line walkthrough
| Code | What it means |
|---|---|
const user = { name: 'Asha', role: 'admin' }; | Part of the Modern JavaScript example — read it together with the lines before and after. |
const { name, role } = user; | Part of the Modern JavaScript example — read it together with the lines before and after. |
const greet = (n) => `Hello, ${n}`; | Defines a function — often a component or event handler. |
const more = { ...user, role: 'editor' }; | Part of the Modern JavaScript example — read it together with the lines before and after. |
How it works (big picture)
- Destructuring pulls fields from objects.
- Arrow functions define components and handlers.
- Spread copies objects when updating state immutably.
Do this on your computer
- Practice destructuring props: function Card({ title, price }) { ... }
- Use import/export between files.
- Replace .then() chains with async/await in fetch examples.
- Read the real-world section and name which part of the app uses this topic.
- Run the example locally and confirm the same behavior in the browser.
- Change one value in the example (text, initial state, or URL) and predict what will happen before you save.
Experiments — try changing this
- 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.
Common questions
Do I need TypeScript?
Optional. Learn JavaScript React first; add TypeScript when comfortable.
How long should I spend on Modern JavaScript?
Until you can explain it in your own words and run the example without looking at the answer. Beginners often need 30–60 minutes per new hook or routing topic; setup lessons may take one afternoon.
What if I get stuck on Modern JavaScript?
Re-read the line-by-line walkthrough, check the browser console for red errors, and compare your code character-by-character with the example. Search the exact error text — someone else had it too.
Where is Modern JavaScript used in real jobs?
See the real-world section above — the same pattern appears in LMS, banking, e-commerce, and SaaS products. Interviewers ask you to explain it using one concrete example from your project or this lesson.