Learn how to fix a layout shift on initial page load in your app
Suspense
boundary. The fallback happens to be null
in this case. This effectively causes the layout shift.Suspense
boundary when serving a page.useEffect
(runs post-hydration)useMemo
to avoid identity changes during hydration.startTransition
and useDeferredValue
to mark updates as non-urgent and prevent fallback rendering. For example, if a layout shift occurs because a context provider’s value changes between server-side rendering and client-side rendering, wrap that value with useDeferredValue
. This allows the client to finish hydrating before React propagates the updated value, avoiding intermediate fallback UI and eliminating the layout shift: