Why I Rebuilt React From Scratch

I wanted to understand React — really understand it. Not just the API, but the engine underneath.

So I built my own version. Not a production framework, just a learning exercise. A few hundred lines of JavaScript that can render components, handle state, and diff a virtual DOM.

Here's what surprised me:

The virtual DOM is simple. It's just a tree of plain objects. The magic isn't in the data structure — it's in the reconciliation algorithm that diffs two trees efficiently.

Hooks are closures. useState is basically an array of values tied to a component's position in the tree. Once you see it, you can't unsee it.

Rendering is the easy part. The hard part is knowing *when* to re-render and *what* to re-render. React's fiber architecture exists to solve scheduling problems, not rendering problems.

Batching matters more than you think. Without batching state updates, you'd re-render on every single setState call. Performance would tank immediately.

Building React taught me more about JavaScript than any course or book. If you want to deeply understand a tool, try rebuilding it from scratch. You'll never look at it the same way.