React Labs: View Transitions & Activity
June 17, 2025React Labs: View Transitions & Activity
Published April 23, 2025 by Ricky Hanlon. React Labs is sharing two new experimental features in react@experimental
and react‑dom@experimental
:
- View Transitions: Wrap UI in
<ViewTransition>
to enable animations using the browser’sstartViewTransition
API. Triggers includestartTransition
,useDeferredValue
, and<Suspense>
. You can customize animations via CSS pseudo-selectors like::view-transition-old(*)
and::view-transition-new(*)
. - Activity: Use
<Activity mode={isVisible ? 'visible' : 'hidden'}>
to unmount UI while preserving state. Hidden components don’t run effects, but their state is saved and can be shown later, enabling state restoration and pre-rendering.
Other in-progress features:
- Performance tracks in React Profiler.
- Automatic injection of effect dependencies via the React compiler.
- IDE extension based on compiler for better diagnostics.
- Fragment refs to group multiple DOM elements.
- Gesture animation support (e.g., swipe transitions).
- Concurrent external store API using
use(store)
.
Example: Basic View Transition
// wrap pages to animate navigation
import { unstable_ViewTransition as ViewTransition } from 'react';
export default function App({ url }) {
return (
{url === '/' ? : }
);
}
Example: Preserving state with Activity
import { unstable_ViewTransition as ViewTransition, unstable_Activity as Activity } from 'react';
export default function App({ url }) {
return (
{url !== '/' && }
);
}
These experimental features are ready to try now in the experimental release; final APIs may change based on feedback.
Blog
What’s New in ECMAScript 2025
Jun 30, 2025
What’s New in ECMAScript 2025 On June 25, 2025, Ecma International officially approved ES2025, adding several useful features: 1. 📦 Import At...
The Difference Between Redux, Context & React Components in State Management
Aug 06, 2025
When building applications with React, there’s always a need to manage data that changes based on user interaction or from fetching external r...
Task Reminder with Laravel & MongoDB
Jun 30, 2025
📌 Building a Task Reminder App This guide shows how to set up a Laravel app using MongoDB to implement a task reminder system with authentication,...
Is Laravel Slow? Optimize Queries & Indexes for Maximum Performance
Jul 20, 2025
A detailed, example-rich guide to avoid slowdowns in Laravel apps by optimizing data retrieval and employing indexing smartly. 1. 🧠 Fetch Only...
ECMAScript 2025 Detailed Update Guide for Frontend Developers
Jul 06, 2025
🔍 ECMAScript 2025 – Detailed Feature Guide All new ECMAScript 2025 features with code examples and explanation of their importance for front...
Top Laravel & PHP Updates for Cleaner, Faster Code
Aug 17, 2025
Laravel Global Scopes: Automatic Query Filtering Eloquent Importance: Enforce consistent filters across all model queries (e.g., Soft Del...
