Skip to main content

One post tagged with "hydration"

View all tags

React 19.3 and browser(): the end of useEffect(() => setMounted(true))

· 11 min read
Bruno Carneiro
Fundador da @TautornTech

If you've ever worked with React and server-side rendering (SSR), you've almost certainly written this:

const [mounted, setMounted] = useState(false);

useEffect(() => {
setMounted(true);
}, []);

if (!mounted) return null;

Or this other version, which looks simpler and is worse:

if (typeof window === 'undefined') return null;

Both exist for the same reason: some components simply have nothing to show on the server. They depend on localStorage, on the user's time zone, on the screen size, on a library that touches window. And React never had an official way to say "this one, browser only".

React 19.3, released on September 9, 2026, changed that. Meet browser().