React

UI = a function of state. That is the whole framework.

▶ the lesson · ~35s · narrated · tap for sound

the intro

React is a JavaScript library for building user interfaces out of small, reusable pieces called components. You describe what the screen should look like for a given state, and React figures out how to update the page when that state changes. Once it clicks, you stop fighting the DOM forever.

the sample

a real component, in full

function Counter() {
  const [n, setN] = useState(0)
  return (
    <button onClick={() => setN(n + 1)}>
      Clicked {n} times
    </button>
  )
}

fun fact ✦

React was born at Facebook in 2011 to tame their own ad-code chaos. Now it runs a huge chunk of the internet.

the docs

quick hits about React

15-second answers · interviews, tips, trivia & hidden gems

🎤 interview

Props or state?

🎤 interview

Why does your useEffect loop forever?

🎤 interview

What does the virtual DOM do?

🎤 interview

Two components need the same data?

📚 tutorial

Forms the React way?

📚 tutorial

Reuse logic between components?

💎 deep

Why not use the index as key?

💎 deep

One component crashes everything?

🆕 update

Still writing useMemo everywhere?

🆕 update

Forms in React 19?

🧠 trivia

React had another name?