Time to Interactive (TTI) and React Hydration
You'll learn: How to measure the critical moment when your React app becomes fully interactive, especially in server-rendered applications where HTML arrives before JavaScript finishes loading.
What is Time to Interactive (TTI)?
Time to Interactive measures how long users wait before they can actually interact with your page. The page might look ready (content visible), but if JavaScript hasn't finished loading and executing, clicks do nothing—buttons don't respond, forms don't submit. It's like seeing a storefront display but finding the door still locked.
The Hydration Problem
In SSR (Server-Side Rendering) or SSG (Static Site Generation) apps, React sends HTML first for fast First Contentful Paint. But this HTML is "dead"—it has no event handlers attached. React must then hydrate it: download JavaScript bundles, execute them, attach event listeners, and reconcile the DOM. Until hydration completes, the app isn't interactive.
Users see content immediately but experience a frustrating gap where clicks are ignored. This gap is your TTI.
Why It Matters
TTI directly impacts user experience. A long TTI means users clicking buttons that don't respond, leading to repeated clicks, confusion, and abandonment. Google's FID (First Input Delay) metric specifically measures this frustration.
Measuring TTI
The web-vitals library doesn't directly report TTI, but you can measure hydration time:
// Track when hydration completes
const hydrationStart = performance.now();
hydrateRoot(document.getElementById('root'), <App />);
requestIdleCallback(() => {
const hydrationTime = performance.now() - hydrationStart;
// Report to analytics
});
Monitor bundle sizes, code-splitting effectiveness, and hydration duration to optimize TTI.
Key Takeaway: TTI measures when your app becomes truly interactive—critical for SSR/SSG apps where visible content arrives before JavaScript execution completes, creating a frustrating gap for users.