Skip to content

Commit 3ca1b85

Browse files
committed
Present Activity form examples step by step
1 parent e42b9a7 commit 3ca1b85

1 file changed

Lines changed: 2 additions & 16 deletions

File tree

‎src/content/reference/react/Activity.md‎

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,7 @@ Changing `mode` preserves the state of the children. Removing the boundary or ch
183183

184184
Because Activity boundaries hide their children without removing them, the children's DOM is also preserved. This is useful for maintaining state held by the browser in DOM nodes.
185185

186-
The Contact tab in the following examples contains an uncontrolled `<textarea>`. Enter a draft, switch to the Home tab, and then return to Contact to compare the behavior with and without Activity.
187-
188-
<Recipes titleText="The difference between removing and hiding a form" titleId="examples-preserving-dom-state">
189-
190-
#### Removing the form resets its state {/*removing-the-form-resets-its-state*/}
191-
192-
This version conditionally renders the active tab. Switching to Home removes `<Contact>` and its `<textarea>` from the DOM, so the draft is lost.
186+
The Contact tab in the following example contains an uncontrolled `<textarea>`. Enter a draft, switch to the Home tab, and then return to Contact. The draft is lost because conditional rendering removes `<Contact>` and its `<textarea>` from the DOM.
193187

194188
<Sandpack>
195189

@@ -265,11 +259,7 @@ b {
265259

266260
</Sandpack>
267261

268-
<Solution />
269-
270-
#### Hiding the form preserves its state {/*hiding-the-form-preserves-its-state*/}
271-
272-
This version renders both tabs in Activity boundaries. Switching tabs hides `<Contact>` without removing its DOM nodes, so the draft remains available when the tab becomes visible again.
262+
To preserve the draft, render both tabs inside Activity boundaries and change their modes. Enter a draft, switch to Home, and then return to Contact. The draft remains because Activity hides `<Contact>` without removing its DOM nodes.
273263

274264
<Sandpack>
275265

@@ -349,10 +339,6 @@ b {
349339

350340
</Sandpack>
351341

352-
<Solution />
353-
354-
</Recipes>
355-
356342
Activity also preserves other browser-managed state, such as scroll position and media playback position. The following examples use the same video player to compare removing and hiding a `<video>` element. Play the video, hide it, show it again, and then select **Play**.
357343

358344
<Recipes titleText="The difference between removing and hiding a video" titleId="examples-preserving-media-state">

0 commit comments

Comments
 (0)