Why React?
Docs15 min
Why React?
Plain DOM code does not scale with state: as the page gets interactive, every change means finding nodes, updating them, and keeping every dependent piece in sync — by hand.
React flips the model. You describe what the UI should look like for a given state; React updates the DOM when the state changes:
function Greeting({ name }) {
return <h1>Hello, {name}</h1>;
}No finding nodes, no manual updates — the function returns a description, and the library does the rest. That is the entire pitch, and it is enough to build anything.
Exercise
In one paragraph: take your click counter from the JS course and describe which parts were "state" and which parts React would now own for you.