You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/reference/react/Activity.md
-153Lines changed: 0 additions & 153 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -164,23 +164,6 @@ h1 {
164
164
}
165
165
```
166
166
167
-
```json package.json hidden
168
-
{
169
-
"dependencies": {
170
-
"react": "experimental",
171
-
"react-dom": "experimental",
172
-
"react-scripts": "latest",
173
-
"toastify-js": "1.12.0"
174
-
},
175
-
"scripts": {
176
-
"start": "react-scripts start",
177
-
"build": "react-scripts build",
178
-
"test": "react-scripts test --env=jsdom",
179
-
"eject": "react-scripts eject"
180
-
}
181
-
}
182
-
```
183
-
184
167
</Sandpack>
185
168
186
169
The Overview section always starts out collapsed. Because we unmount the sidebar when `isShowingSidebar` flips to `false`, all its internal state is lost.
@@ -288,23 +271,6 @@ h1 {
288
271
}
289
272
```
290
273
291
-
```json package.json hidden
292
-
{
293
-
"dependencies": {
294
-
"react": "experimental",
295
-
"react-dom": "experimental",
296
-
"react-scripts": "latest",
297
-
"toastify-js": "1.12.0"
298
-
},
299
-
"scripts": {
300
-
"start": "react-scripts start",
301
-
"build": "react-scripts build",
302
-
"test": "react-scripts test --env=jsdom",
303
-
"eject": "react-scripts eject"
304
-
}
305
-
}
306
-
```
307
-
308
274
</Sandpack>
309
275
310
276
Our sidebar's internal state is now restored, without any changes to its implementation.
video { width: 300px; margin-top: 10px; aspect-ratio: 16/9; }
1355
1219
```
1356
1220
1357
-
```json package.json hidden
1358
-
{
1359
-
"dependencies": {
1360
-
"react": "experimental",
1361
-
"react-dom": "experimental",
1362
-
"react-scripts": "latest",
1363
-
"toastify-js": "1.12.0"
1364
-
},
1365
-
"scripts": {
1366
-
"start": "react-scripts start",
1367
-
"build": "react-scripts build",
1368
-
"test": "react-scripts test --env=jsdom",
1369
-
"eject": "react-scripts eject"
1370
-
}
1371
-
}
1372
-
```
1373
-
1374
1221
</Sandpack>
1375
1222
1376
1223
It works great! Our cleanup function ensures that the video stops playing if it's ever hidden by an Activity boundary, and even better, because the `<video>` tag is never destroyed, the timecode is preserved, and the video itself doesn't need to be initialized or downloaded again when the user switches back to keep watching it.
0 commit comments