Skip to content

This notebook belongs to

Sadat Jubayer

Senior Software Engineer at Premio

If found, please return to hello@jubayer.dev

Vol. 7Seven years of building

Started
January 2020
Everyday tools
TypeScript, Vue, React, Next.js, NestJS, React Native
Education
B.Sc. CSSE, AIUB, 2020
2 min readReact

Try upcoming React features with Canary

Pin matching React and React DOM Canary builds, then check the export before trying ViewTransition in an app.

If your stable React build has no ViewTransition export, you can try it with a pinned Canary pair. Check both package versions and the export before changing a screen.

Pin React and React DOM together

Start on a branch where you can keep your current dependency files for comparison. In an app that installs React directly, use these exact dependency entries in package.json for the experiment.

{
  "dependencies": {
    "react": "19.3.0-canary-f646e8ff-20251104",
    "react-dom": "19.3.0-canary-f646e8ff-20251104"
  }
}

After installing from the manifest, both packages should resolve to the build ending in f646e8ff-20251104. Merge the entries into your existing dependencies so the rest of your setup comes along.

The canary npm tag moves as React publishes builds. The version in this example identifies one build, including its commit and date. If you start with the tag, check the resulting manifest and pin the two resolved versions. Save the lockfile with it so a clean install uses the same dependency tree.

Use an exact version. React can change APIs between Canary builds, and their hashes sort ahead of their dates in semver comparisons. The React Canaries announcement asks users to pin one build and review the commits when they upgrade.

Check the export before changing a screen

Save this as check-react.mjs and run it with Node from your app directory.

import { version, ViewTransition } from 'react'
import { version as domVersion } from 'react-dom'

console.log(version === domVersion, typeof ViewTransition)

With the pair above, the script prints true symbol. If your installed React lacks the named export, Node stops at the import. Check the installed dependencies and your lockfile before debugging a component that never loaded.

Once the import works, wrap one piece of UI in ViewTransition and update its state inside startTransition. Pick something easy to see, such as swapping a thumbnail when you pick a photo. The React Labs example shows how React connects that update to the browser's View Transition API.

Keep the dependency change in its own commit. For the next trial, pick another exact build for both packages, read the commits between the two hashes and rerun the screen you changed. If the API shifted, you can restore the previous manifest and lockfile as a pair.