Why is React Used?

Subtopic 1 of 3

Here are the concrete reasons developers choose React:
a) Component-Based Architecture
React breaks the UI into small, reusable pieces called components. Each component manages its own appearance and logic.

jsx// A reusable Button component
function Button({ label, onClick }) {
return {label};
}

// Reuse it anywhere
function App() {
return (
alert('Saved!')} />
alert('Cancelled!')} /> );}
One Button component, used in 100 places. Change it once, it updates everywhere.

b) Declarative UI
In vanilla JavaScript, you tell the browser how to update the DOM step by step (imperative). In React, you just describe what the UI should look like for a given state (declarative). React handles the rest.

jsx// Declarative: just describe what you want
function Counter() {
const [count, setCount] = React.useState(0);
return (Count: {count}
setCount(count + 1)}>Increment;);
}

You never manually write document.getElementById(‘count’).innerText = count.

React updates the DOM automatically.

c) Fast Performance via Virtual DOM

d) Huge Ecosystem & Community
React has millions of developers, thousands of libraries (React Router, Redux, TailwindCSS, etc.), and is used by companies like Meta, Netflix, Airbnb, Twitter, and Uber.

e) React Native (Write Once, Run on Mobile)
The same React knowledge lets you build iOS and Android apps using React Native. One language, multiple platforms.