Stop paying the workaround tax.
3 complaints. 3 workarounds we all ship. What they really cost.
Let's talk React.
Nabil Nalakath
Principal Engineer, Eli Lilly
Views and opinions in this talk are my own and do not represent those of my employer.
Nobody has ever filed a bug that says
“missing useMemo.”
They say one thing:
“Something feels off.”
Meet ChaiCart.
A tiny shop app. Three real bugs.
Open it.
Right now.
- 1Type in the search box.
- 2Tap any product.
- 3Watch the delivery time.
Three tickets came in.
You're probably thinking:
“We already fix these.”
You do.
With workarounds.
Every workaround charges a tax.
Three of them just got refunded.
* GST applicable on every render.
The delivery time lies.
Hydration: the server sends a photo of the page, and React brings it to life. If the photo and the live page disagree, React throws the photo away and redraws.
The server renders in UTC.
Your phone lives in IST.
Same component. Two different answers.
✋
Hands up if you've shipped this.
Hydration fixes, ranked
- ✕An extra render
- ✕A blank flash
- ✕The layout jumps
And every team writes its own version.
import { use } from 'react'; import { browser } from 'react-dom'; function DeliveryTime() { use(browser()); // skip on the server return <p>Delivers by {eta()}</p>; }
<Suspense fallback={<EtaSkeleton />}> <DeliveryTime /> </Suspense>
mounted flagNothing suspends, so Suspense never kicks in. Two renders, and a placeholder you size by hand.throw on serverThe old Suspense trick. Works, but React treats it as an error, so it fills your logs.use(browser())Suspends on the server only. One render in the browser. No effect, no fake error.Same Suspense you already use.
New: an official way to say “wait for the browser.”
1 line.
No flicker. No red console.
setMounted(true) in your code is a candidate.Typing freezes the page.
Memoization: remembering an answer so you don't redo the sum every time someone types.
240
cards re-render on every keystroke.
Type one letter: the page re-renders, and by default React re-renders every card inside it, even the ones that didn't change.
Every streamed word is a keystroke.
An answer streaming in updates the chat dozens of times a second. Every message re-renders on every word. Same tax, paid per token.
memo(Card)Skip this card if its props haven't changed.useMemoReuse this value until its inputs change.useCallbackKeep the same function, so memo() still matches.You decide what to cache, and you list what it depends on. By hand.
- ✕Dependency-array bugs
- ✕Stale closures
- ✕Code nobody wants to read
const ProductCard = memo(Card); <ProductCard item={item} style={{ margin: 8 }} // new object onAdd={() => add(item)} // new function /> // memo() now does nothing
Two ways to fix it
- Pick what to cache
- Write the dependency arrays
- Keep them right, forever
- Reads every component
- Works out what each value depends on
- Adds the caching for you
It runs when you build, not in the browser. Your source code stays plain.
- const list = useMemo(() =>- items.filter(match(q)), [items, q]);+ const list = items.filter(match(q)); - const onAdd = useCallback(add, [add]);+ const onAdd = add; - export default memo(ProductCard);+ export default ProductCard;
function ProductList({ items, q }) { const $ = _c(3); // 3 cache slots let list; if ($[0] !== items || $[1] !== q) { // inputs changed? list = items.filter(match(q)); // yes: recompute $[0] = items; $[1] = q; $[2] = list; } else { list = $[2]; // no: reuse } … }
Every component gets this, including each card: if its product didn't change, it reuses last time's result.
The compiler isn't new.
v1.0 shipped in 2025. What's new: the Rust version is fast enough to turn on everywhere.
// vite.config.ts import react from '@vitejs/plugin-react'; export default { plugins: [react({ compiler: true })], };
Is it on? React DevTools marks every compiled component with a Memo ✨ badge.
14.3s → 0.81s
Compile time, Babel compiler vs Rust compiler.
Outlyne case study · September 2026
It won't fix:
- ✕Slow APIs
- ✕Giant bundles
- ✕Bad algorithms
It doesn't feel like an app.
View Transition: the browser takes a "before" and "after" screenshot and animates between them.
npm i framer-motion gsap react-spring<motion.img layoutId={`img-${id}`} />
Same id in both places. Your JavaScript measures both positions and moves the image, frame by frame.
document.startViewTransition(() =>
flushSync(() => setOpen(id))
);
The browser animates, but React has to update right now, inside the callback.
Either you ship the animation code, or you fight React's timing.
- ✕A library in every bundle
- ✕Blind to Suspense
- ✕flushSync hacks
Hard cut, or morph?
Photo of the old screen
Updates the page, once it's ready
Photo of the new screen
Morphs old into new. Same name = it flies.
<ViewTransition> tells React what to photograph and when. No animation code ships to the user.
import { ViewTransition } from 'react'; // In the grid card <ViewTransition name={`img-${id}`}> <img src={p.image} /> </ViewTransition> // In the detail page: same name <ViewTransition name={`img-${id}`}> <img src={p.image} /> </ViewTransition> // The navigation must be a Transition startTransition(() => navigate(`/p/${id}`));
Same name in two places
= it flies.
startTransition(() => {
addTransitionType('back');
navigate(-1);
});
<ViewTransition
enter={{ next: 'from-right', back: 'from-left' }}
/>
Skeleton: instant.
Content: animated.
<ViewTransition update="auto" default="none"> <Suspense fallback={<CardSkeleton />}> <ProductDetails id={id} /> </Suspense> </ViewTransition>
Animate only when the skeleton is replaced by real content. Every other update: no animation.
Happy with Framer Motion? Keep it.
Reach for ViewTransition when animations need to follow transitions and loading states.
Zero animation libraries.
Stable since React 19.3, September 9, 2026.
<ViewTransition>.Try it again.
Search, tap a product, check the delivery time.
ChaiCart, then vs now
How it started
- 4hand-written memos
- 1hydration error
- 0animations
How it's going
- 0hand-written memos
- 0hydration errors
- 3animations
A few dozen lines.
“Something feels off.” → “It feels like an app.”
Questions?
Try the app:
Nabil Nalakath · @nabilnalakath
Thank you.
And thanks to React Bangalore and DevRev for hosting.
ispeakcode.medium.com