Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
Question 1 of 10 · React Basics and JSX
Interview question

What is React and why is it used? React क्या है और इसे क्यों use करते हैं?

Answer

React is a JavaScript library developed by Facebook for building user interfaces with reusable components. It uses a virtual DOM for efficient updates and enables building interactive single-page applications (SPAs).

FeatureDescription
Component-basedBuild UI with reusable components
Virtual DOMEfficient rendering with virtual representation
Unidirectional data flowEasier debugging and data tracking
SEO friendlyCan be rendered on server-side
Large ecosystemRich libraries and tools available
// Creating a basic React component
import React from 'react';
import ReactDOM from 'react-dom';

function App() {
    return (
        <div>
            <h1>Welcome to React!</h1>
            <p>React makes building UI easy and fun.</p>
        </div>
    );
}

// Rendering the component
ReactDOM.render(<App />, document.getElementById('root'));

// With React 18
import { createRoot } from 'react-dom/client';

const root = createRoot(document.getElementById('root'));
root.render(<App />);

// Why React?
// 1. Reusable components reduce code duplication
// 2. Virtual DOM improves performance
// 3. One-way data binding makes code predictable
// 4. Large community and ecosystem
// 5. Easy to learn and master
// 6. Used by major companies (Facebook, Netflix, Airbnb)

React एक JavaScript library है Facebook द्वारा बनाई गई। Reusable components से UI बनाते हैं। Virtual DOM से efficient rendering होती है।

FeatureDescription
Component-basedReusable components से UI बनाना
Virtual DOMEfficient rendering
One-way data flowPredictable data flow

Was this answer clear?