DEV Community

Narasimma Radhakrishnan
Narasimma Radhakrishnan

Posted on

React.js for Beginners: My First Step into React ⚛️

After learning HTML, CSS, and JavaScript, I started learning React.js.

At first, React looked confusing because of components, props, state, and JSX. But after understanding the basics, I realized that React is a powerful way to build user interfaces.

What is React?

React is a JavaScript library used to build user interfaces, especially for web applications.

React was created by Meta (Facebook).

Instead of creating one large webpage, React allows us to divide the UI into smaller reusable components.

What is a Component?

A component is a reusable piece of the user interface.

For example:

Navbar

Button

Login Form

Card

Footer

Simple React component:

function Welcome() {
  return <h1>Hello, World!</h1>;
}

export default Welcome;
Enter fullscreen mode Exit fullscreen mode

What is JSX?

JSX allows us to write HTML-like code inside JavaScript.

function App() {
  return (
    <div>
      <h1>Welcome to React</h1>
      <p>I'm learning React!</p>
    </div>
  );
}
Enter fullscreen mode Exit fullscreen mode

It makes UI code easier to understand.

What are Props?

Props are used to pass data from one component to another.

function Student(props) {
return <h2>Hello {props.name}</h2>;
}

We can use the component like this:

What is State?

State stores information that can change inside a component.

For example, a counter:

import { useState } from "react";

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

  return (
    <button onClick={() => setCount(count + 1)}>
      Count: {count}
    </button>
  );
}
Enter fullscreen mode Exit fullscreen mode

When the button is clicked, the count increases.

Why Learn React?

React is useful for building:

🌐 Websites

📱 Web applications

📊 Dashboards

🛒 E-commerce applications

💻 Full Stack applications

React is also widely used with technologies like Node.js, Express, and MongoDB.

My Learning Path

As a beginner, I'm focusing on learning React step by step:

HTML → CSS → JavaScript → React → APIs → Full Stack

I believe understanding JavaScript properly makes learning React much easier.

Conclusion

React may look difficult at first, but don't try to learn everything at once.

Start with:

Components → JSX → Props → State → Events → Hooks

Then practice by building small projects.

Learn → Practice → Build → Improve 🚀

react #javascript #webdev #beginners

Top comments (0)