Skip to content
React

React 19.3 Stabilizes View Transitions and Fragment Refs

React 19.3 brings stable View Transitions and Fragment Refs, enhancing animation and DOM control. Learn how to integrate these features.

Topic
React
Reading time
5 min
Length
1,079 words
Published
Sep 10, 2026
11:15 pm IST
In this article
  1. View Transitions: Smooth Operator
  2. Customizing Animations: A Closer Look
  3. Integrating Suspense and View Transitions
  4. Fragment Refs: Making DOM Manipulation Easier
  5. Adopting These Features: A Practical Guide
  6. Weighing the Trade-offs

React 19.3 just hit npm, and it's making waves with two significant updates: the stabilization of View Transitions and Fragment Refs. Previously, these were experimental, so this change is big news for anyone dealing with production-level React code. Let’s see what makes these features worthwhile.

View Transitions: Smooth Operator

Have you ever wanted to animate elements entering or exiting a page? That's where the <ViewTransition> component comes into play. This tool works with the browser’s View Transition API to manage animations involving elements that enter, exit, move, or resize. It was experimental, but now in React 19.3, it's officially stable. Wrap your UI pieces in <ViewTransition>, and you’ve got smooth animations whenever these parts change. These animations kick in when an update marked as a transition alters a child component's style or when the ViewTransition itself mounts or unmounts.

React has a way of figuring out which animation to use based on how the component tree changes:

  • Enter: When you add the <ViewTransition> to the DOM.
  • Exit: When the <ViewTransition> exits the DOM.
  • Update: Happen when the styles or content inside a <ViewTransition> shift.
  • Share: When a named <ViewTransition> moves from one place to another.

I should point out that updates not marked as transitions won't animate; they're meant to instantly reflect changes in the UI. Transitions occur for state updates inside functions like startTransition or a <Suspense> reveal, as well as updates from useDeferredValue.

import { ViewTransition, useState, startTransition } from 'react';
import { Video } from './Video';
import videos from './data';

export default function Component() {
  const [showItem, setShowItem] = useState(false);
  return (
    <>
      <button => {
        startTransition(() => {
          setShowItem((prev) => !prev);
        });
      }}>
        {showItem ? '➖' : '➕'}
      </button>
      {showItem && (
        <ViewTransition>
          <Video video={videos[0]} />
        </ViewTransition>
      )}
    </>
  );
}

The <ViewTransition> component cross-fades by default. Want something fancier? Use a View Transition Class to define your own animations in CSS, or go with the Web Animations API using event props like onEnter, onExit, onShare, and onUpdate.

Customizing Animations: A Closer Look

Need different animations for similar state changes? The addTransitionType function lets you tailor animations based on types like 'next' or 'previous'. Take a carousel: moving forward should push slides right-to-left, while reversing them slides left-to-right. Even if both actions set the currentSlide to 3, the animations stay distinct thanks to transition types.

import { ViewTransition, addTransitionType, useState, startTransition } from 'react';
import { Video } from './Video';
import videos from './data';

export default function Component() {
  const [selected, setSelected] = useState(0);
  const video = videos[selected];
  return (
    <>
      <div className="button-container">
        <button => {
          startTransition(() => {
            addTransitionType('previous');
            setSelected(c => c > 0 ? c - 1 : videos.length - 1);
          });
        }}>⬅️</button>
        <button => {
          startTransition(() => {
            addTransitionType('next');
            setSelected(c => c + 1 < videos.length ? c + 1 : 0);
          });
        }}>➡️</button>
      </div>
      <ViewTransition key={video.id} enter={{ 'next': 'from-right', 'previous': 'from-left' }} exit={{ 'next': 'to-left', 'previous': 'to-right' }}>
        <Video video={video} />
      </ViewTransition>
    </>
  );
}

By customizing transitions, you align animations with user actions, greatly enhancing user experience. React maps each Transition Type to a browser view transition type. This allows CSS scoping with :active-view-transition-type(...).

Integrating Suspense and View Transitions

View Transitions can play along with Suspense, animating as Suspense boundaries reveal new content. Just wrap a <Suspense> boundary with a <ViewTransition>. But hold on – use animations wisely for cached UI, which should appear instantly to avoid frustrating users.

When content finishes loading, React moves from the fallback to the actual content using update animations. Here's a sample:

import { Suspense, useState, startTransition, use, ViewTransition } from 'react';
import { Video, VideoPlaceholder } from './Video';
import { fetchVideo } from './data';

export default function Component() {
  const [showItem, setShowItem] = useState(false);
  return (
    <>
      <button => {
        startTransition(() => {
          setShowItem((prev) => !prev);
        });
      }}>
        {showItem ? '➖' : '➕'}
      </button>
      {showItem && (
        <ViewTransition update="auto" default="none">
          <Suspense fallback=<VideoPlaceholder />>
            <LazyVideo />
          </Suspense>
        </ViewTransition>
      )}
    </>
  );
}

function LazyVideo() {
  const video = use(fetchVideo());
  return <Video video={video} />;
}

These animations ensure your app feels responsive yet is visually appealing as content loads. Here’s how to keep the user interface snappy:

  • Fallbacks should pop up immediately, no animation needed.
  • Animate the transition from fallback content to final content.
  • Content that doesn’t suspend? Show it right away, without animations.

This strategy keeps things quick when the content is already there, using animations just for smoother transitions when necessary. In the example, setting update="auto" and default="none" disables non-essential animations, keeping toggling instant once loaded.

Fragment Refs: Making DOM Manipulation Easier

Fragment Refs in React 19.3 open up new ways to handle DOM nodes without disrupting component structures. Got components that render multiple siblings without a wrapper? Fragment Refs let you focus, add event listeners, and observe, all without touching component guts. It's a handy solution for messy layouts.

function Component() {
  const fragmentRef = useRef(null);
  useEffect(() => {
    const fragmentInstance = fragmentRef.current;
    fragmentInstance.focus();
  }, []);
  return (
    <Fragment ref={fragmentRef}>
      {posts.map(post => (
        <Heading key={post.id}>
          {post.title}
        </Heading>
      ))}
    </Fragment>
  );
}

Fragment Refs simplify DOM node management, especially when dealing with components that dynamically render item lists, enabling direct DOM manipulation without adding unnecessary parent elements.

Adopting These Features: A Practical Guide

Ready to integrate these features into your codebase? Here’s where to start:

  • Review Existing Animations: Look for static UI elements that could benefit from animations and think about applying <ViewTransition>.
  • Implement <ViewTransition>: Wrap existing UI components to bring animations to life. Start with visually changing elements like modals, dropdowns, or tabs.
  • Leverage addTransitionType: Tailor animations for unique interactions in navigation-heavy interfaces, such as carousels or step-based forms.
  • Utilize Fragment Refs: Simplify complex DOM manipulations without altering structures, especially for dynamic content updates.

Weighing the Trade-offs

Sure, these features are impressive, but don't get carried away. <ViewTransition> works only in DOM environments for now, with React Native support on the horizon. Use animations carefully to dodge performance hiccups, especially for UI that should load instantly. Fragment Refs are great but can complicate things if overused, so handle with care to keep your component logic clean. Also, consider the potential DOM manipulation overhead when using Fragment Refs extensively.

React 19.3 is a leap forward in UI development, offering dynamic tools for animations and DOM management. As always, test thoroughly across environments to ensure a seamless transition. Aim to balance these tools with a good understanding of where animations and direct DOM manipulations can boost user experience, all while keeping performance on track.

Sources

React 19.3

Every claim above was checked against this source before publishing. The analysis, the code and the opinions are mine.

Frequently asked

What is the ViewTransition component in React 19.3?

The ViewTransition component allows developers to animate elements as they enter, exit, move, or resize, using the browser's View Transition API.

How can animations be customized in React 19.3?

Animations can be customized using the addTransitionType function, which allows specifying different animations based on transition types such as 'next' or 'previous'.

What are Fragment Refs used for?

Fragment Refs allow developers to manipulate DOM nodes of components rendering multiple siblings without a single parent, offering methods like focus and addEventListener.

What environments do View Transitions currently support?

As of React 19.3, View Transitions support only DOM environments, with plans for future support in React Native.

Deepak Kumar

Written by

Deepak Kumar

Sr Software Engineer at India Today Group | Aaj Tak · MERN Stack · Generative AI

I have written React for production since 2017 — component libraries, editorial dashboards, and the front end of a live election results screen that updates while millions of people are watching it. I write here about what those systems actually do once real traffic hits them.

Message me