React Patterns, Good Practices & Internals
This is not React documentation. It is a senior engineer sitting beside you: “Run this. What do you think will happen? Now change this line. See that? Here's why React behaves that way.” Render vs commit, reconciliation, Fiber, state snapshots, stale closures, refs, performance, async React and internals — with real production bugs and interview-ready answers.
Render vs commit, how React decides what changed, and why component state survives — or doesn't.
- Step 1
Render vs Commit
React does two separate things, and conflating them is the single most common source of wrong mental models. R...
Start Lesson - Step 2
Components Must Be Pure
A React component must behave like a mathematical function of its props, state and context: same inputs, same ...
Start Lesson - Step 3
Reconciliation
Reconciliation is how React decides what changed. It compares the tree your render just returned against the t...
Start Lesson - Step 4
Fiber Mental Model
You do not need React's source code to reason about Fiber. You need one picture: for every component that is c...
Start Lesson - Step 5
Keys and List Identity
When React reconciles a list, it has to decide which of last render's children corresponds to which of this re...
Start Lesson - Step 6
Using Keys to Reset State
Keys are not only for lists. Because a key is part of a component's identity, changing the key of a single ele...
Start Lesson - Step 7
Component Identity
Identity is decided by the element type React sees at a position — and the type is compared by reference. That...
Start Lesson - Step 8
Why State Sometimes Resets
You now have every rule needed to explain state resets. This lesson turns them into a single decision procedur...
Start Lesson - Step 9
Conditional Rendering and Identity
Conditional rendering quietly changes the shape of the children array, and the shape is what React uses to lin...
Start Lesson - Step 10
Fragments and Keys
Fragments let a component return several elements without adding a DOM node. When a fragment is produced insid...
Start Lesson
State as a snapshot, batching, functional updates, immutability, and deciding where state should live.
- Step 11
State Is a Snapshot
`useState` does not give you a live binding to a value. It gives you the value for *this* render, frozen. Ever...
Start Lesson - Step 12
Batching State Updates
React does not re-render once per `setState` call. It collects every update triggered in the same tick and pro...
Start Lesson - Step 13
Functional State Updates
`setState(next)` says "make it this". `setState(prev => next)` says "apply this transformation to whatever is ...
Start Lesson - Step 14
Never Mutate State
React decides whether state changed with `Object.is` — a reference comparison for objects and arrays. Mutate a...
Start Lesson - Step 15
Immutable Array Updates
Half of JavaScript's array methods mutate in place and half return a new array. Using the wrong half is the mo...
Start Lesson - Step 16
Immutable Object Updates
Spreading an object copies it one level deep. Nested objects are copied by reference, so a spread at the top l...
Start Lesson - Step 17
Avoid Redundant State
If a value can be computed during render from props or other state, it should not be state. Storing it creates...
Start Lesson - Step 18
Avoid Contradictory State
Two booleans can express four combinations, but a request that is both loading and successful is not one of yo...
Start Lesson - Step 19
State Normalization
When the same entity appears in more than one place in your state tree, updating it means finding and updating...
Start Lesson - Step 20
Lifting State Up
When two components must agree about something, the state belongs to their closest common parent. Each child t...
Start Lesson - Step 21
State Colocation
Lifting state up is a fix, not a default. State that has been lifted higher than it needs to be makes every si...
Start Lesson - Step 22
Preserving vs Resetting State
Module 1 established what decides identity. This lesson turns it into a design decision: for a given screen, d...
Start Lesson
When you don't need an effect, dependencies, stale closures, cleanup, and async race conditions.
- Step 23
You Might Not Need an Effect
`useEffect` is for synchronising with systems outside React — the DOM, a subscription, a network connection, a...
Start Lesson - Step 24
Effect Lifecycle
An effect does not have a "mount" and an "unmount". It has a setup and a cleanup, and React may run that pair ...
Start Lesson - Step 25
Dependency Arrays
The dependency array is not a configuration knob for how often an effect should run. It is a declaration of ev...
Start Lesson - Step 26
Stale Closures
A stale closure is the snapshot rule from Module 2 meeting a long-lived callback. An interval, a subscription ...
Start Lesson - Step 27
Infinite Effect Loops
An effect that sets state that is also in its own dependency array creates a loop: set → render → dependency c...
Start Lesson - Step 28
Object Dependencies
React compares dependencies with `Object.is`. An object literal created during render is a new reference every...
Start Lesson - Step 29
Function Dependencies
Functions are objects too. A function declared in a component body is a new reference every render, so an effe...
Start Lesson - Step 30
Effect Cleanup
Every effect that starts something must be able to stop it: listeners, intervals, subscriptions, observers, op...
Start Lesson - Step 31
Fetch Race Conditions
Requests do not resolve in the order you sent them. Type fast in a search box and a slow early request can lan...
Start Lesson - Step 32
AbortController
The ignore flag prevents a stale result from being *applied*. AbortController goes further and stops the reque...
Start Lesson - Step 33
Event Logic vs Effect Logic
Some code runs because the user did something. Other code runs because the component is displayed and must sta...
Start Lesson - Step 34
Strict Mode and Double Effect Execution
In development, Strict Mode renders your component twice and immediately mounts, unmounts and remounts it. It ...
Start Lesson
State vs ref, DOM access, and why reusing a custom hook reuses logic — never state.
- Step 35
State vs Ref
Both `useState` and `useRef` remember a value across renders. Exactly one of them tells React that something c...
Start Lesson - Step 36
Persistent Values with useRef
A ref is the right home for anything that must survive re-renders but has no business on screen: interval ids,...
Start Lesson - Step 37
DOM References
Passing a ref to a DOM element makes React put the real node in `ref.current` after commit. That is your escap...
Start Lesson - Step 38
Previous Value Pattern
React gives you the current value. When you need the previous one — to animate a direction, to detect a crossi...
Start Lesson - Step 39
Timers with Refs
Debouncing, throttling and delayed actions all need to reach a timer that a previous render created. That hand...
Start Lesson - Step 40
Ref vs Local Variable
A variable declared inside a component looks like it persists. It does not — it is recreated on every call, li...
Start Lesson - Step 41
Imperative Handles
Sometimes a parent legitimately needs to command a child: focus this field, play this video, scroll this list ...
Start Lesson - Step 42
Custom Hooks with State and Refs
A custom hook is a function whose name starts with `use` and that calls other hooks. There is no other machine...
Start Lesson - Step 43
Custom Hooks Share Logic, Not State
This is the misconception that survives longest in otherwise strong React developers: importing the same custo...
Start Lesson
What actually causes a render, referential equality, memo/useMemo/useCallback — and when not to.
- Step 44
What Actually Causes a Render?
There are exactly three reasons React calls your component function. Knowing the list by heart turns "why did ...
Start Lesson - Step 45
Parent Re-renders and Child Re-renders
When a parent renders, React walks into its children and renders them too — by default, regardless of whether ...
Start Lesson - Step 46
Props Do Not Independently Trigger Renders
"A component renders when its props change" is the most repeated wrong sentence in React. This lesson disprove...
Start Lesson - Step 47
Render Does Not Mean DOM Update
Module 1 introduced this. Now that you are about to start optimizing, it matters commercially: a render you we...
Start Lesson - Step 48
Unnecessary Re-renders
A re-render only matters when it is expensive or frequent. Before memoizing, it is almost always better to mov...
Start Lesson - Step 49
React.memo
`React.memo` wraps a component so that, when its parent renders, React first compares the new props with the o...
Start Lesson - Step 50
Referential Equality
One rule underlies effect dependencies, `React.memo`, `useMemo` and `useCallback`: React compares with `Object...
Start Lesson - Step 51
What Shallow Comparison Actually Means
People say “React.memo does a shallow comparison” and “React compares with Object.is” as if they were the same...
Start Lesson - Step 52
useMemo
`useMemo` caches a computed value between renders and recomputes it only when a dependency changes. It has two...
Start Lesson - Step 53
Stabilising a Reference
Once you know a new reference defeats memo and re-fires effects, the question becomes: how do I stop creating ...
Start Lesson - Step 54
useCallback
`useCallback(fn, deps)` is `useMemo(() => fn, deps)` with nicer syntax. It caches a function's identity, not i...
Start Lesson - Step 55
Stable Callbacks from Custom Hooks
A custom hook that returns functions is publishing an API, and the identity of those functions is part of it. ...
Start Lesson - Step 56
When NOT to Memoize
Memoization is not free. Every `memo` adds a props comparison, every `useMemo`/`useCallback` adds a dependency...
Start Lesson - Step 57
When a New Reference Is the Bug
So far a new reference has cost you a wasted render. Sometimes it costs you correctness — because the object *...
Start Lesson - Step 58
React Compiler Mental Model
The React Compiler automatically inserts the memoization you would have written by hand. Understanding what it...
Start Lesson - Step 59
Context Re-render Problems
Context solves prop drilling, not performance. Every consumer re-renders when the provider's value changes — a...
Start Lesson - Step 60
Splitting Context
One context per concern, and often one for the value and another for the setters. Consumers then subscribe onl...
Start Lesson - Step 61
Large List Performance
Ten thousand rows is the one case where the DOM really is the bottleneck. No amount of memoization helps, beca...
Start Lesson - Step 62
React Profiler
Everything in this module was measured with console logs. The `<Profiler>` component does it properly: React r...
Start Lesson - Step 63
Identity & Memoization — the Whole Map
Everything in this module descends from one JavaScript fact: `Object.is` compares primitives by value and ever...
Start Lesson
Controlled vs uncontrolled, propagation, defaults, and form state architecture.
- Step 64
Controlled vs Uncontrolled Inputs
A controlled input renders the value React holds in state. An uncontrolled input keeps its own value inside th...
Start Lesson - Step 65
Passing vs Calling Event Handlers
`onClick={handleClick}` passes a function. `onClick={handleClick()}` calls it during render and passes the res...
Start Lesson - Step 66
Callback Arity: the Arguments You Didn't Ask For
The previous lesson was about passing a function instead of calling it. This one is about what happens *after*...
Start Lesson - Step 67
Event Propagation
A click on a button inside a card inside a list fires handlers on all three, innermost first. That bubbling is...
Start Lesson - Step 68
stopPropagation
`e.stopPropagation()` prevents the event from continuing to ancestor handlers. It is the correct fix for the d...
Start Lesson - Step 69
preventDefault
Some elements have built-in browser behaviour: forms navigate on submit, links navigate on click, checkboxes t...
Start Lesson - Step 70
Form State Architecture
One `useState` per field is fine for two fields and unmanageable for twelve. A single object, or a reducer, ke...
Start Lesson - Step 71
Derived Validation
Validation is the purest case of derived state: errors are a function of the current values. Storing them in s...
Start Lesson
Composition, context, headless logic, compound components, reducers and explicit state machines.
- Step 72
Composition
The first instinct when a component needs to vary is to add a prop. Do it five times and you have a component ...
Start Lesson - Step 73
children
`children` is an ordinary prop that happens to have JSX syntax. Once you see it that way, two things follow: i...
Start Lesson - Step 74
Prop Drilling
Passing a prop through four components that do not use it is a smell — but it is not automatically a problem, ...
Start Lesson - Step 75
Context
Context is dependency injection for a subtree. It is the right tool for ambient values, and the wrong tool for...
Start Lesson - Step 76
Custom Hooks
A good custom hook extracts a *behaviour*, not a chunk of code. The test is whether its name describes somethi...
Start Lesson - Step 77
Headless Logic
A headless component owns behaviour, state and accessibility, and renders nothing opinionated. The caller supp...
Start Lesson - Step 78
Compound Components
Compound components are several components that only make sense together and share state implicitly through co...
Start Lesson - Step 79
Controlled Component APIs
Designing a reusable component means deciding who owns its state. A controlled component owns none: it renders...
Start Lesson - Step 80
Controlled and Uncontrolled APIs
Most good library components support both: pass `value` and they are controlled; pass `defaultValue` and they ...
Start Lesson - Step 81
State Reducer Pattern
The ultimate inversion of control: the component computes what it *would* do, then hands the proposed next sta...
Start Lesson - Step 82
useReducer
`useReducer` moves state transitions out of your handlers and into one function that answers: given this state...
Start Lesson - Step 83
Designing Explicit State Machines
A reducer with a `status` field is already a state machine. Making it explicit — listing which transitions are...
Start Lesson - Step 84
Avoiding God Components
A 600-line component with nine `useState`s and four effects is not a styling problem. It is several components...
Start Lesson - Step 85
Separating UI from Behaviour
A component that fetches, transforms, tracks and renders is hard to test and impossible to reuse. Splitting th...
Start Lesson - Step 86
Choosing State Ownership
The closing lesson of the module, and the decision you will make most often: should this state be local, lifte...
Start Lesson
Async UI states, Suspense, error boundaries, transitions, optimistic UI and the modern action APIs.
- Step 87
Async UI States
Every async operation has at least four states — idle, loading, success, error — and most also have empty and ...
Start Lesson - Step 88
Async Race Conditions
Module 3 fixed races inside effects. Races also happen in event handlers — two submits, two saves, and the slo...
Start Lesson - Step 89
Suspense Mental Model
Suspense moves loading states out of the component that loads and into the tree above it. A component says "I ...
Start Lesson - Step 90
Error Boundaries
An uncaught error during render unmounts your entire application — React would rather show nothing than someth...
Start Lesson - Step 91
Urgent vs Non-Urgent Updates
Typing must feel instant. The expensive list that reacts to typing does not. Concurrent React lets you say whi...
Start Lesson - Step 92
useTransition
`useTransition` gives you two things: a way to mark updates as non-urgent, and an `isPending` flag telling you...
Start Lesson - Step 93
useDeferredValue
`useDeferredValue` is the transition you reach for when you do **not** own the state update — the value arrive...
Start Lesson - Step 94
Optimistic UI
Optimistic UI shows the result of an action before the server has confirmed it. Done well it makes an app feel...
Start Lesson - Step 95
useOptimistic
`useOptimistic` builds the previous lesson into React. You show an optimistic value during an async action, an...
Start Lesson - Step 96
Actions and Form Actions
React 19 lets a `<form>` take a function as its `action`. React calls it with the FormData, keeps the pending ...
Start Lesson - Step 97
useActionState
`useActionState` is the reducer pattern applied to async form actions: it holds the result of the last submiss...
Start Lesson - Step 98
use() Mental Model
`use()` reads a resource — a promise or a context — and suspends if it is not ready. Unlike every other hook, ...
Start Lesson
Sixteen lessons that start broken. Reproduce the symptom, find the root cause, ship the fix.
- Step 99
Bug: Index Key
Reported by QA: “Deleting a task moves the checkbox ticks to the wrong tasks.” The delete function is correct....
Start Lesson - Step 100
Bug: Random Key
Reported by a user: “I can't type in the search box — it loses focus after every letter.” A developer had adde...
Start Lesson - Step 101
Bug: Component Defined Inside a Component
Reported by a designer: “The modal's form resets whenever I type in it, and the fade-in animation replays cons...
Start Lesson - Step 102
Bug: Stale Closure
Reported by support: “The auto-save says it saved, but it always saves an old version of the note.”...
Start Lesson - Step 103
Bug: Missing Effect Dependency
Reported by QA: “Switching chat rooms shows the new room's name in the header but keeps delivering messages fr...
Start Lesson - Step 104
Bug: Infinite Effect Loop
Reported by ops: “This page pins a CPU core and the browser tab becomes unresponsive after a few seconds.”...
Start Lesson - Step 105
Bug: State Mutation
Reported by QA: “Adding an item to the cart does nothing — until you click something else, and then it appears...
Start Lesson - Step 106
Bug: Fetch Race Condition
Reported by a user: “The product page sometimes shows the wrong product — the one I looked at before.”...
Start Lesson - Step 107
Bug: Wrong Async Result
Reported by a user: “I clicked Save on the third draft, but it saved the first one.”...
Start Lesson - Step 108
Bug: Missing Effect Cleanup
Reported by ops: “The dashboard gets slower the longer people use it, and memory climbs until the tab crashes....
Start Lesson - Step 109
Bug: Context Render Storm
Reported by QA: “Typing anywhere in the app is laggy, and the profiler says two hundred components render per ...
Start Lesson - Step 110
Bug: Derived State Desynchronisation
Reported by QA: “The order total is wrong after applying a discount, but only sometimes.”...
Start Lesson - Step 111
Bug: Expensive Render
Reported by a user: “Typing in the filter box is unusable — each letter takes half a second to appear.”...
Start Lesson - Step 112
Bug: Over-Memoization
Reported in code review: “Everything is wrapped in memo, useMemo and useCallback, but the profiler says this p...
Start Lesson - Step 113
Bug: Ref Changed but the UI Did Not
Reported by QA: “The unread-message counter never updates, but if I click anything else it jumps to the right ...
Start Lesson - Step 114
Bug: Custom Hook “Shared” State
Reported by a developer: “I extracted the cart into `useCart()` and imported it in the header and the checkout...
Start Lesson
Elements, Fibers, the two trees, lanes, scheduling, concurrency, hydration and the server boundary.
- Step 115
JSX to React Elements
JSX is not part of JavaScript. It is syntax sugar that a compiler turns into ordinary function calls, and the ...
Start Lesson - Step 116
Elements vs Components vs DOM Nodes
Three words that beginners use interchangeably and that senior interviews expect you to separate precisely....
Start Lesson - Step 117
Fiber Nodes
A Fiber is a plain JavaScript object — one per component instance in the tree — holding everything React needs...
Start Lesson - Step 118
Hooks and Fiber Storage
Hooks are stored as a linked list on the Fiber and matched **by call order**. That single implementation detai...
Start Lesson - Step 119
Current Tree vs Work-in-Progress Tree
React keeps two trees. One is on screen; the other is being built. They swap in a single operation at commit....
Start Lesson - Step 120
Reconciliation Deep Dive
React's diff is O(n) rather than the O(n³) a general tree diff would cost. It gets there by making two assumpt...
Start Lesson - Step 121
Child Reconciliation
The list algorithm is worth knowing precisely, because it is where keys earn their existence and where the ind...
Start Lesson - Step 122
Keys and Fiber Identity
This closes the loop opened in lesson 5. You have now seen keys from the outside as a bug and from the inside ...
Start Lesson - Step 123
Component Type and Identity
Type is the other half of identity, and it is compared by reference — which makes it possible to break it acci...
Start Lesson - Step 124
Render Phase
The render phase calls your components and builds the work-in-progress tree. It is asynchronous, interruptible...
Start Lesson - Step 125
Commit Phase
The commit phase applies the marked changes to the DOM. Unlike render, it is synchronous and cannot be interru...
Start Lesson - Step 126
Effect Processing
Effects do not run where they appear in your code. React collects them during commit and flushes them in a def...
Start Lesson - Step 127
Update Queues
Each state hook owns a circular linked list of pending updates. During render React replays that queue from th...
Start Lesson - Step 128
State Batching Internals
Batching is not a special case for event handlers. React schedules work on a lane and flushes it at the end of...
Start Lesson - Step 129
Scheduling
React does not render the moment you call setState. A scheduler decides when the work runs, and yields to the ...
Start Lesson - Step 130
Update Priorities
Not all updates deserve the same urgency. React assigns a priority based on what caused the update, and higher...
Start Lesson - Step 131
Lanes
Lanes are how React represents priority: a 31-bit bitmask where each bit is a lane. It replaced an older numer...
Start Lesson - Step 132
Concurrent Rendering
Concurrent rendering means React can work on more than one version of the UI at a time and choose when to show...
Start Lesson - Step 133
Interruptible Rendering
The practical face of concurrency: React can abandon a render that is no longer worth finishing, and start aga...
Start Lesson - Step 134
Why Render Must Be Pure
You have now met every reason. This lesson collects them into the single argument you would give in an intervi...
Start Lesson - Step 135
Why React Can Throw Away a Render
React discards rendering work routinely, and in more situations than most developers realise....
Start Lesson - Step 136
Strict Mode Mental Model
Strict Mode is a development-only test harness that simulates the things React is allowed to do, so bugs surfa...
Start Lesson - Step 137
Hydration
Hydration is React attaching to server-rendered HTML that already exists — adopting the DOM instead of creatin...
Start Lesson - Step 138
Server Components vs Client Components
The final lesson, and the newest boundary in React: some components run only on the server and never ship to t...
Start Lesson
Portals, a11y, focus, code splitting, HOCs vs hooks, refs, testing, classes, legacy answers, security, tearing — plus live-coding, code-review, trade-off and diagnosis rounds, TypeScript, data fetching, forms, error boundaries, Server Components, frontend system design, the bug you cannot reproduce, two rapid-fire rounds, a spot-the-bug speed round, a predict-the-console-order game, the platform features you no longer have to build, the rules of hooks broken on purpose, and twelve answers that sound right and aren't.
- Step 139
Portals and Where Events Actually Go
A portal renders a component's DOM somewhere else — usually `document.body`, to escape a parent's `overflow: h...
Start Lesson - Step 140
Accessible Components by Default
Most accessibility bugs in React are not exotic. They are a `<div onClick>` that should have been a `<button>`...
Start Lesson - Step 141
Focus Management in Dialogs
Opening a dialog and leaving focus behind is the most common accessibility failure in React apps — and a great...
Start Lesson - Step 142
Code Splitting with lazy + Suspense
`React.lazy` turns a component into one that loads its own code on first render, and `Suspense` shows somethin...
Start Lesson - Step 143
HOCs, Render Props and Hooks
Three generations of the same idea: reuse behaviour without duplicating it. Interviewers ask about all three, ...
Start Lesson - Step 144
Composing and Merging Refs
Sooner or later two things want the same DOM node: your own measurement code and a ref the parent passed in. A...
Start Lesson - Step 145
useId and Stable Identifiers
Accessible markup needs ids to link labels, errors and descriptions to their inputs. Generating those ids with...
Start Lesson - Step 146
Testing Behaviour, Not Implementation
“How do you test a React component?” is really asking whether you know what is worth asserting. The answer tha...
Start Lesson - Step 147
Dev Build vs Production Build
“The app is much slower locally than in production” is a real observation with a boring explanation, and knowi...
Start Lesson - Step 148
Reading Unfamiliar React Code
The course's actual success metric: hand you code you have never seen and have you predict what React will do ...
Start Lesson - Step 149
Class Components and Their Hook Equivalents
Interviewers ask about classes for two honest reasons: real codebases still contain them, and the lifecycle-to...
Start Lesson - Step 150
Legacy Answers They Still Ask
Some interview questions are about React that no longer exists. Answering “that was removed in React 17, and h...
Start Lesson - Step 151
Security: dangerouslySetInnerHTML, XSS and Links
React escapes everything you interpolate into JSX, which prevents the overwhelming majority of XSS by default....
Start Lesson - Step 152
useLayoutEffect vs useEffect: Choosing
Lesson 119 showed where each one sits in the commit phase. This is the decision rule, which is what an intervi...
Start Lesson - Step 153
Tearing and useSyncExternalStore
You have used `useSyncExternalStore` twice in this course without being told why it exists. It exists because ...
Start Lesson - Step 154
The Rapid-Fire Round
Thirty questions a senior React interview actually asks, with answers short enough to say out loud. Answer eac...
Start Lesson - Step 155
Interview: What Happens When You Type in an Input?
One keystroke, traced end to end. This is the single best synthesis question an interviewer can ask, because a...
Start Lesson - Step 156
Live Coding: Build a Typeahead
The most common React live-coding task there is. It looks like a twenty-line component and quietly tests six t...
Start Lesson - Step 157
Live Coding: Write a Custom Hook to Spec
“Write me a hook that…” is the second most common live task. It is short enough to finish and specific enough ...
Start Lesson - Step 158
Interview: The Code Review Round
Some interviews hand you a pull request instead of a blank editor. It is a faster signal than live coding: it ...
Start Lesson - Step 159
Interview: State Management Trade-offs
“Would you use Redux here?” is not a question about Redux. It is checking whether you classify state before ch...
Start Lesson - Step 160
Interview: “The App Is Slow” — A Diagnosis Method
An open-ended performance question is testing method, not tricks. A candidate who starts adding `memo` has alr...
Start Lesson - Step 161
Interview: The TypeScript Round
Almost every React role is a TypeScript role now, and the questions are rarely about syntax. They are about wh...
Start Lesson - Step 162
Interview: The Data Fetching Round
"How do you fetch data in React?" is a trap only if you answer with an API. The interviewer is checking whethe...
Start Lesson - Step 163
Interview: The Forms Round
Forms are the most-built and least-discussed part of a frontend job. An interviewer asking about them is usual...
Start Lesson - Step 164
Interview: Error Handling and Resilience
"What happens when a component throws?" has a specific, checkable answer: React unmounts the entire tree. Not ...
Start Lesson - Step 165
Interview: The Server Components Round
This round has one real question wearing several costumes: **for any given piece of code, do you know where it...
Start Lesson - Step 166
Interview: Frontend System Design — A Notifications Feed
The senior round is rarely "implement this". It is "design this, out loud, and defend your choices" — and the ...
Start Lesson - Step 167
Interview: The Bug You Cannot Reproduce
"A user reports the submit button charges them twice. You cannot reproduce it. What do you do?" This question ...
Start Lesson - Step 168
Interview: The Second Rapid-Fire Round
Thirty more one-line questions, harder than the first round and drawn from everything this course has covered....
Start Lesson - Step 169
Interview: The Spot-the-Bug Speed Round 🔍
Ten snippets. Each has **exactly one** bug. You get to name it, then find out if you were right....
Start Lesson - Step 170
Interview: Predict the Console Output 🎯
Here is a question with exactly one right answer and no room to waffle: **a parent renders a child, both have ...
Start Lesson - Step 171
Interview: React vs the Platform
A question senior interviewers love, because it catches people who have only ever learned React: **"how would ...
Start Lesson - Step 172
Interview: Break the Rules of Hooks on Purpose
Everyone can recite the rules: no hooks in conditions, no hooks in loops, no hooks after an early return. Almo...
Start Lesson - Step 173
Interview: Answers That Sound Right and Aren't
Every one of these is repeated confidently in blog posts, tutorials and interviews. Every one is wrong, or wro...
Start Lesson - Step 174
Interview: The Controlled Input That Fights You
Format a card number as the user types — a space every four digits. Ten lines of code, ships on Tuesday, and b...
Start Lesson - Step 175
Interview: The Context Performance Round
*"We put the theme, the user and the cart in one context. Now everything re-renders. What happened?"* — a ques...
Start Lesson
Write a working useState and a tiny renderer from scratch, then the patterns that need the model: recursion, latest-ref, time travel, FLIP animation and infinite scroll.
- Step 176
Build Your Own useState
Module 10 told you hooks are a linked list on the Fiber, matched by call order. This lesson makes you build it...
Start Lesson - Step 177
Build a Tiny React
Elements are plain objects, rendering turns them into DOM, and reconciling compares old and new. You have been...
Start Lesson - Step 178
Recursive Components
A component may render itself. That is how you draw comment threads, file trees, nested menus and org charts w...
Start Lesson - Step 179
The Latest Ref Pattern
You have two bad options for a callback inside a long-lived subscription: let it go stale, or re-subscribe on ...
Start Lesson - Step 180
Undo, Redo and Time Travel
Undo is where immutability stops being a rule you follow and becomes a feature you ship. If past states were n...
Start Lesson - Step 181
FLIP Animations and List Identity
Animating a list reorder looks like a CSS problem and is actually an identity problem. You can only animate an...
Start Lesson - Step 182
Infinite Scroll with IntersectionObserver
Infinite scroll is the lesson where four modules meet: an effect with real cleanup, a race condition, a ref ca...
Start Lesson