Table of Contents
If you’re reading this, welcome — you’ve taken the first step into the world of modern web development. This friendly react tutorial for beginners will guide you, in plain language, through everything you need to build your first React component. It explains not only the “how” but also the “why,” so by the end you’ll feel confident and clear.
What is React and why learn it?
React is a JavaScript library used to build user interfaces. Instead of writing one big page, React helps you split a page into small, reusable pieces called components. Each component does one job — like showing a header, a profile card, or a button. This makes your code easier to read, test, and reuse.
Learning React JS Course is useful because it is used by many websites and it fits well with full-stack tools. If you want to build full applications later, React works smoothly with Node, Express, and MongoDB in a MERN Stack Web Development. That means you can learn front-end and then connect it to a server and database.
Tools you need to start
You don’t need a powerful computer or special software to begin. Here’s what most beginners use:
- Node.js and npm (or yarn) installed on your computer.
- A code editor like VS Code.
- A terminal to run commands.
The fastest way to start a new React project is:
npx create-react-app my-app
cd my-app
npm start
This creates a ready-to-go app where you can build your first component. Many people following a react tutorial for beginners find this the easiest path because it removes setup trouble.
What is a component? A simple idea
A component is like a small building block. Think of a webpage as a house: each room is a component. A component usually has three things:
- Markup — what the user sees (like headings and buttons).
- Logic — how it behaves (clicks, counters).
- Styles — how it looks (colors and spacing).
React puts these together so each part of your UI is one small, independent unit. When components are small and clear, your app becomes easier to change and grow.
Build your first component — step by step
Let’s make a tiny example. Inside the src/ folder, create Greeting.js:
// Greeting.js
import React from “react”;
function Greeting(props) {
return (
<div>
<h2>Hello, {props.name}!</h2>
<p>Welcome to this React JS for Beginners example.</p>
</div>
);
}
export default Greeting;
Now open src/App.js and use it:
import React from “react”;
import Greeting from “./Greeting”;
function App() {
return (
<div>
<Greeting name=”Asha” />
<Greeting name=”Ravi” />
</div>
);
}
export default App;
Save and open your browser. You should see two greetings. You just built and reused a component — a key idea in every react tutorial for beginners.
JSX — HTML inside JavaScript
JSX looks like HTML mixed with JavaScript. It lets you write what the UI should look like inside your JavaScript file. When you see {props.name}, that tells React to insert the value from JavaScript into the page. JSX makes writing components fast and clear.
Props vs State — the simple difference
- Props are values that a parent gives to a child component. They are read-only inside the child. Use props to make a component show different content.
- State is internal data the component manages itself. When state changes, React updates the screen.
For example, props let you reuse the Greeting component for many users. State is useful for things like counters, form inputs, or whether a menu is open.
Add state with hooks — a tiny upgrade
Modern React uses hooks. The most common is useState. Here’s a small counter component:
import React, { useState } from “react”;
function Counter() {
const [count, setCount] = useState(0);
return (
<div>
<p>Count: {count}</p>
<button onClick={() => setCount(count + 1)}>Increase</button>
</div>
);
}
Hooks make function components powerful. useEffect is another hook that runs code when a component mounts or updates, like fetching data from an API.
Common mistakes beginners make (and how to avoid them)
- Forgetting a single root element — return one parent element from a component (use <div> or <>…</>).
- Changing state directly — always use the updater (setCount) instead of changing variables directly.
- Making giant components — if a component gets long, split it into smaller parts.
- Putting too much logic in JSX — keep complex code in helpers or functions.
Following these habits will keep your code tidy and easier to fix.
Where to go next — a clear path
After you learn components, props, state, and hooks, try these next steps:
- Handle forms and validation.
- Fetch data from APIs using fetch or Axios.
- Add routing with React Router.
- Learn simple state sharing with Context API or try Redux later.
- Deploy your app to a hosting service.
If you want a guided course that links front-end to back-end, consider a MERN Stack Web Development Course — it teaches React with Node, Express, and MongoDB so you can build full web apps.
Final tips — keep practicing
Build small projects: a to-do list, a weather app, or a simple blog UI. Read the official docs and follow a practical react tutorial for beginners to reinforce your learning. Practice helps ideas stick, and small wins build confidence.