DEV Community

Raja B
Raja B

Posted on

React

React

What is React?

React is a JavaScript library used to build user interfaces (UI) for websites and web applications.

It helps developers create fast, interactive, and reusable web pages.

Created by: Meta (Facebook)

Example websites that use React:

  • Facebook

  • Instagram

  • Netflix

  • WhatsApp Web


Why do we use React?

Without React:

  • We write lots of JavaScript

  • Updating the page is difficult

  • Code becomes large

With React:

  • Code is shorter

  • Easy to manage

  • Faster updates

  • Reuse the same code many times


What is a Component?

A Component is a small piece of a webpage

Think of a webpage like a house

  • House → Webpage

  • Room → Component

Example:

Web Page

├── Header
├── Menu
├── Profile
├── Products
├── Footer
Enter fullscreen mode Exit fullscreen mode

Each part is a component


Why Components?

Instead of writing the same code again and again, we create it once and reuse it

Example:

<Button />

<Button />

<Button />
Enter fullscreen mode Exit fullscreen mode

One Button component can be used many times

Top comments (0)