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
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ While hidden, children still re-render in response to new props, albeit at a low
51
51
52
52
When the boundary becomes <CodeStepstep={3}>visible</CodeStep> again, React will reveal the children with their previous state restored, and re-create their Effects.
53
53
54
-
In this way, Activity can thought of as a mechanism for rendering "background activity". Rather than completely discarding content that's likely to become visible again, you can use Activity to maintain and restore that content's UI and internal state, while ensuring hidden content has no unwanted side effects.
54
+
In this way, Activity can be thought of as a mechanism for rendering "background activity". Rather than completely discarding content that's likely to become visible again, you can use Activity to maintain and restore that content's UI and internal state, while ensuring that your hidden content has no unwanted side effects.
55
55
56
56
[See more examples below.](#usage)
57
57
@@ -62,15 +62,15 @@ In this way, Activity can thought of as a mechanism for rendering "background ac
62
62
63
63
#### Caveats {/*caveats*/}
64
64
65
-
-When used with `<ViewTransition>`, hidden activities that reveal in a transition will activate an "enter" animation. Visible Activities hidden in a transition will activate an "exit" animation.
65
+
-If an Activity is rendered inside of a [ViewTransition](/reference/react/ViewTransition), and it becomes visible as a result of an update caused by [startTransition](/reference/react/startTransition), it will activate the ViewTransition's `enter` animation. If it becomes hidden, it will activate its `exit` animation.
66
66
67
67
---
68
68
69
69
## Usage {/*usage*/}
70
70
71
71
### Restoring the state of hidden components {/*restoring-the-state-of-hidden-components*/}
72
72
73
-
Typically in React, when you want to conditionally show or hide a component, you mount and unmount it:
73
+
In React, when you want to conditionally show or hide a component, you typically mount or unmount it based on that condition:
74
74
75
75
```jsx
76
76
{isShowingSidebar && (
@@ -88,11 +88,11 @@ When you hide a component using an Activity boundary instead, React will "save"
88
88
</Activity>
89
89
```
90
90
91
-
This makes it possible to restore components to their previous state.
91
+
This makes it possible to hide and then later restore components in the state they were previously in.
92
92
93
-
The following example has a sidebar with an expandable section – you can press "Overview" to reveal the three subitems below it. The main app area also has a button that hides and shows the sidebar.
93
+
The following example has a sidebar with an expandable section. You can press "Overview" to reveal the three subitems below it. The main app area also has a button that hides and shows the sidebar.
94
94
95
-
Try expanding the Overview section, then toggling the sidebar closed and open:
95
+
Try expanding the Overview section, and then toggling the sidebar closed then open:
0 commit comments