Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11542,7 +11542,7 @@ Try searching for a video, selecting it, and clicking "back":
<Sandpack>

```js src/App.js
import { unstable_ViewTransition as ViewTransition, Activity } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router";
import { unstable_ViewTransition as ViewTransition } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router"; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;

export default function App() {
const { url } = useRouter();
Expand Down Expand Up @@ -12879,7 +12879,7 @@ With this update, if the content on the next page has time to pre-render, it wil
<Sandpack>

```js src/App.js
import { unstable_ViewTransition as ViewTransition, Activity, use } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router"; import {fetchVideos} from './data'
import { unstable_ViewTransition as ViewTransition, use } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router"; import {fetchVideos} from './data'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;

export default function App() {
const { url } = useRouter();
Expand Down
11 changes: 6 additions & 5 deletions src/content/reference/react/Activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ and check out the new behavior:
<Sandpack>

```js src/App.js active
import { Activity, useState } from 'react';
import { useState } from 'react'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;

import Sidebar from './Sidebar.js';

export default function App() {
Expand Down Expand Up @@ -425,7 +426,7 @@ If we switch to using an Activity boundary to show and hide the active tab, we c
<Sandpack>

```js src/App.js active
import { useState, Activity } from 'react';
import { useState } from 'react'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
import TabButton from './TabButton.js';
import Home from './Home.js';
import Contact from './Contact.js';
Expand Down Expand Up @@ -703,7 +704,7 @@ Try clicking the Posts tab now:
<Sandpack>

```js src/App.js
import { useState, Suspense, Activity } from 'react';
import { useState, Suspense } from 'react'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
import TabButton from './TabButton.js';
import Home from './Home.js';
import Posts from './Posts.js';
Expand Down Expand Up @@ -1127,7 +1128,7 @@ Let's update `App` to hide the inactive tab with a hidden Activity boundary inst
<Sandpack>

```js src/App.js active
import { useState, Activity } from 'react';
import { useState } from 'react'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
import TabButton from './TabButton.js';
import Home from './Home.js';
import Video from './Video.js';
Expand Down Expand Up @@ -1261,7 +1262,7 @@ Let's see the new behavior. Try playing the video, switching to the Home tab, th
<Sandpack>

```js src/App.js active
import { useState, Activity } from 'react';
import { useState } from 'react'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
import TabButton from './TabButton.js';
import Home from './Home.js';
import Video from './Video.js';
Expand Down