|1. Introduction to React
Chapter 1React Tutorial~1 min read

Introduction to React

React म्हणजे काय?

React ही एक JavaScript library आहे जी user interfaces बनवायला वापरतात. Meta (Facebook) ने 2013 मध्ये open source केली. React मध्ये UI छोट्या छोट्या components मध्ये विभागतात — प्रत्येक component स्वतंत्र, reusable आणि maintainable असतो.

Marathi Analogy

React म्हणजे LEGO blocks सारखे! Navbar, Button, Card, Footer — प्रत्येक piece वेगळा बनव आणि एकत्र जोड. एखादा block बदलला तरी बाकी सगळं सुरक्षित असतं. हेच component-based architecture!

React का वापरतात?

  • Component-based — UI छोट्या reusable pieces मध्ये divide करतो
  • Virtual DOM — फक्त बदललेले parts update होतात, खूप fast
  • Declarative — "काय दाखवायचे" सांगा, "कसे" React बघतो
  • Huge ecosystem — हजारो libraries, React Native (mobile)
  • Meta, Netflix, Instagram, Airbnb — सगळे React वापरतात

React चा इतिहास

  • 2013 — Facebook ने open source केले
  • 2015 — JSX popular झाले
  • 2018 — Hooks आले, functional components standard झाले
  • 2024 — React 19: use API, Actions, React Compiler

Virtual DOM कसे काम करते?

Browser चा real DOM slow असतो. React एक Virtual DOM (JavaScript object) maintain करतो. State बदलली की React आधी Virtual DOM update करतो, मग real DOM शी compare करतो (diffing), आणि फक्त बदललेले parts real DOM मध्ये update करतो. यामुळे performance खूप चांगली होते.

पहिला React Component

jsx
// App.jsx
export default function App() {
  return (
    <div>
      <h1>नमस्कार! React मध्ये स्वागत! ⚛️</h1>
      <p>हा माझा पहिला React component आहे.</p>
    </div>
  );
}
💡

React शिकायला आधी HTML, CSS आणि JavaScript (especially ES6 — arrow functions, destructuring, .map()) माहीत असायला हवे. JavaScript नीट माहीत असेल तर React खूप सोपे वाटेल!

Key Points — लक्षात ठेवा

  • React = UI बनवायची JavaScript library (framework नाही!)
  • Component-based architecture — reusable UI pieces
  • Virtual DOM — fast, efficient updates
  • Declarative UI — what to show, not how to show
  • React 19 — latest version, use API, Actions, Compiler
0/12 chapters पूर्ण