JavaScript

React Fundamentals

Start your React journey! Learn about JSX, Components, Props, and the Virtual DOM.

By TechCoder TeamLast updated: 2026-06-02
In a Nutshell

Start your React journey! Learn about JSX, Components, Props, and the Virtual DOM. This hands-on tutorial focuses on practical implementation of react fundamentals concepts.

React Fundamentals

React is all about Components. A component is a small, reusable piece of code that represents a part of the UI.

1. JSX (JavaScript XML) πŸ“

React uses a syntax called JSX. It looks like HTML, but it's actually JavaScript.

JAVASCRIPT PLAYGROUND
⏳ Loading editor…

Why use JSX? It allows us to keep the logic (JS) and the view (HTML) in the same file.

Rules of JSX:

  1. Return One Parent: You must wrap everything in a single tag (like <div> or <>...</>).
  2. CamelCase: Use className instead of class, onClick instead of onclick.
  3. Close Tags: Self-closing tags must end with /> (e.g., <img />).

2. Creating Components 🧱

A React component is just a JavaScript function that returns JSX.

JAVASCRIPT PLAYGROUND
⏳ Loading editor…

Note: Component names MUST start with a Capital Letter.

3. Props (Properties) 🎁

Props are how we pass data down from a parent to a child. They are like HTML attributes.

JAVASCRIPT PLAYGROUND
⏳ Loading editor…

Important: Props are Read-Only. A child cannot change its props.

4. Conditional Rendering πŸ”€

We use standard JavaScript logic (if/else, ternary operators) to decide what to show.

JAVASCRIPT PLAYGROUND
⏳ Loading editor…

5. Lists & Keys πŸ“‹

To render a list of items, we use the .map() array method.

JAVASCRIPT PLAYGROUND
⏳ Loading editor…

Why key? React needs a unique key for each item to track changes efficiently.

AI Mentor

Confused about "React fundamentals, JSX syntax, functional components, props, and conditional rendering"? Ask our AI mentor for a simplified explanation.

Quiz

Quiz

Question 1 of 4

What is JSX?

A new HTML version
JavaScript XML syntax extension
A database language
A CSS framework

Key Takeaways

βœ… JSX mixes HTML and JS.
βœ… Components are functions starting with a Capital Letter.
βœ… Props pass data down.
βœ… Keys are required for lists.

What's Next?

Static components are boring. Let's make them interactive with React Hooks!

Keep coding! πŸš€