#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Web Development · React JS

React JS Basics Explained for Complete Beginners

React is a JavaScript library for building user interfaces from small, reusable pieces called components. Learn the handful of ideas that make everything else click.

Tracks
React Building Blocks · Live Interactive
Concept
—
What it is
Code
—
How you write it
Result
—
What users see
Component → Props → State → UI
Click a concept to see the React idea, the code and the result on screen.

Home / Tutorials / Career Guides / React JS Basics Explained for Complete Beginners

Web Development · React JS

React JS Basics Explained for Complete Beginners

IDEA 1 IDEA 2 IDEA 3 RESULT Components Small functions Return JSX Build Props Data from parent Read-only Pass State Changing data Triggers render Update UI Fast updates Reusable parts App
Components receive props, keep their own state, and React re-renders the UI whenever that data changes.

Quick summary — React JS basics

React JS basics come down to a few ideas: build the UI from components, describe each one with JSX, pass data down with props, keep changing data in state with useState, handle events like clicks, and run side effects such as API calls with useEffect. Master these and you can build real interactive pages.

In this guide you will learn:

  1. Components and JSX — how React describes UI.
  2. Props and state — how data flows and changes.
  3. Events, lists and effects — making pages interactive.
  4. A first project plan — with templates and a checklist.
  5. Interview basics — React questions beginners face.

SECTION 01Components and JSX: how React describes UI

In React, a component is a JavaScript function that returns what should appear on screen. JSX lets you write that output in a syntax that looks like HTML, which React turns into real page elements. You will write every React screen this way, from a single button to a full dashboard, so it is worth getting comfortable with the syntax before moving on.

IdeaExampleRule to rememberCommon beginner mistake
Componentfunction Welcome() { return <h1>Hi</h1>; }Name starts with a capital letterNaming it welcome() in lowercase
JSX expressions<p>{user.name}</p>Curly braces hold JavaScriptWriting if statements directly inside JSX
Attributes<img src={url} alt="logo" />Use className, not classUsing class="..."
One parentreturn <>...</>Return a single root elementReturning two siblings without a wrapper
// App.jsx (created with: npm create vite@latest my-app -- --template react)
function Welcome({ name }) {
  return <h1 className="title">Hello, {name}!</h1>;
}

export default function App() {
  return (
    <>
      <Welcome name="Asha" />
      <Welcome name="Ravi" />
    </>
  );
}
App.jsx
Key insight: Think of components as custom HTML tags you create. Once a page is split into components, each piece is easy to build and reuse.

SECTION 02Props and state: how data flows and changes

Props and state are the two kinds of data in React. Props come from outside and are read-only. State belongs to the component and can change, and every change re-renders the component. Most beginner bugs in React come from mixing these two up, so read the table slowly and try each example in a fresh Vite project.

PropsStateExample
Who owns itThe parent componentThe component itselfA Cart owns items; an Item gets props
Can it change?Not by the childYes, through the settersetCount(count + 1)
How to create<Item price={499} />const [count, setCount] = useState(0)Counter starts at 0
When UI updatesWhen the parent passes new propsWhen the setter is calledClicking a button updates a count
import { useState } from "react";

export default function Counter() {
  const [count, setCount] = useState(0);

  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>Add</button>
      <button onClick={() => setCount(0)}>Reset</button>
    </div>
  );
}
Counter.jsx
Key insight: Never change state directly, such as items.push(). Always create a new value and pass it to the setter so React knows something changed.

SECTION 03Events, lists and effects: making pages interactive

Real apps respond to clicks and typing, show lists of data and load information from servers. These three patterns cover most beginner projects. Practise each pattern in a tiny component of its own before combining them; that way, when something breaks, you know exactly which part to look at.

PatternReact toolExampleRemember
Handle eventsonClick, onChange, onSubmit<input onChange={e => setText(e.target.value)} />Pass a function, do not call it
Render listsarray.map()items.map(i => <li key={i.id}>...)Each item needs a stable key
FormsControlled inputsvalue={text} with onChangeCall e.preventDefault() on submit
Load datauseEffect + fetchFetch users after first renderSet the dependency array correctly
import { useState } from "react";

export default function Todos() {
  const [text, setText] = useState("");
  const [todos, setTodos] = useState([]);

  function handleSubmit(e) {
    e.preventDefault();
    if (!text.trim()) return;
    setTodos([...todos, { id: Date.now(), text }]);
    setText("");
  }

  return (
    <form onSubmit={handleSubmit}>
      <input value={text} onChange={(e) => setText(e.target.value)} />
      <button>Add</button>
      <ul>{todos.map((t) => <li key={t.id}>{t.text}</li>)}</ul>
    </form>
  );
}
Todos.jsx
Key insight: Keys help React track list items between renders. Use a stable id, not the array index, whenever items can be added, removed or reordered.

SECTION 04First React project templates

Use these templates to plan and finish your first React project. Pick a topic you personally care about — cricket scores, recipes or movies — because you will spend more time on a project you enjoy.

First React Project: Movie Watchlist
Components:
  App → SearchBar, MovieList → MovieCard, Watchlist
State:
  query (string), results (array), watchlist (array)
Features:
  ☐ Search movies from a public API
  ☐ Show results as cards
  ☐ Add/remove from watchlist
  ☐ Save watchlist in localStorage
  ☐ Loading and error messages
Deploy: Netlify / Vercel / GitHub Pages
react-first-project.md

SECTION 05Tips for learning React as a beginner

These habits help React make sense faster:

  • Learn JavaScript first — arrays, objects, arrow functions and map make React much easier.
  • Draw the component tree — plan components and where state lives before coding.
  • Keep state minimal — store only what changes; calculate the rest during render.
  • Use React DevTools — inspect props and state in the browser while debugging.
  • Build, then rebuild — make the same small app twice to lock in the patterns.
Pro tip: Most React confusion is really JavaScript confusion. If something feels hard, revise the JavaScript concept behind it.

SECTION 06Interview Q&A — React JS basics

Q1What is React?

A JavaScript library for building user interfaces from reusable components. It updates the page efficiently when data changes.

Q2What is JSX?

A syntax extension that lets you write HTML-like code inside JavaScript. Build tools convert it into regular JavaScript calls.

Q3What is the difference between props and state?

Props are read-only data passed from a parent. State is data a component manages itself and can change, causing a re-render.

Q4Why do list items need keys?

Keys let React identify which items changed, were added or removed, so it can update the list correctly and efficiently.

Q5What does useEffect do?

It runs side effects, such as fetching data or setting up subscriptions, after rendering. The dependency array controls when it runs again.

SECTION 07Test yourself — React JS basics quiz

Five questions. No sign-up.

0 / 5

Pick an answer to see why it is right or wrong.

SECTION 08Frequently asked questions

Is React easy for beginners?

React is beginner-friendly once you know JavaScript basics. The core ideas — components, props, state and effects — are few and reusable.

What should I learn before React?

HTML, CSS and JavaScript fundamentals, especially arrays, objects, functions, arrow functions and fetch.

Is React a framework or a library?

React is a library for building user interfaces. Frameworks such as Next.js build on top of it.

How long does it take to learn React basics?

With solid JavaScript, many learners grasp the basics in a few weeks of regular practice and small projects.

Can I get a job with only React?

Frontend roles usually expect React plus strong HTML, CSS and JavaScript, Git, and often some API and testing knowledge.

Classroom & online · Noida

Go from frontend to full stack

Our Python Training Course covers Python, web frameworks, REST APIs and SQL — the backend skills that pair with React for full stack work.

Talk to a counsellor for current fees
  • Python and web frameworks
  • REST APIs and SQL
  • Mock interviews
  • Weekday & weekend batches