Skip to content

Commit d03f08c

Browse files
authored
Supplement Documentation for pop() Function (#545)
1 parent 9098e93 commit d03f08c

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

docs/pages/docs/get-started/navigating-activities.en.mdx

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,22 @@ type ArticleParams = {
145145
const Article: ActivityComponentType<ArticleParams> = ({ params }) => {
146146
const { pop } = useFlow();
147147

148-
const onClick = () => {
148+
const goBack = () => {
149+
// Pop a single activity
149150
pop();
150151
};
151152

153+
const goBackMultiple = () => {
154+
// Pop multiple activities
155+
pop(3);
156+
};
157+
152158
return (
153159
<AppScreen appBar={{ title: "Article" }}>
154160
<div>
155161
<h1>{params.title}</h1>
156-
<button onClick={onClick}>back</button>
162+
<button onClick={goBack}>Back</button>
163+
<button onClick={goBackMultiple}>Back 3 Steps</button>
157164
</div>
158165
</AppScreen>
159166
);
@@ -162,18 +169,25 @@ const Article: ActivityComponentType<ArticleParams> = ({ params }) => {
162169
export default Article;
163170
```
164171

165-
`pop()` takes an optional first parameter for additional options. This first parameter can be omitted, and default values will be used.
172+
`pop()` takes optional parameters for the number of stacks to pop and additional options. These parameters can be omitted, and default values will be used.
166173

167174
```ts
168-
pop();
175+
pop(); // pop a single stack
176+
177+
pop(3); // pop multiple stacks
169178

170-
// or
171179
pop({
172180
/* additional option */
173-
});
181+
}); // pop a single stack with additional options
182+
183+
pop(3, {
184+
/* additional option */
185+
}); // pop multiple stacks with additional options
174186
```
175187

176-
The first parameter of the `pop()` function, additional options, includes the following values.
188+
The first parameter of the pop() function can specify the number of stacks to pop or define additional options. If the first parameter is used for the number of stacks, the second parameter can then be used to provide additional options.
189+
190+
The additional options include the following values.
177191

178192
<APITable hasDefaultValue>
179193
| | | | |
@@ -183,4 +197,4 @@ The first parameter of the `pop()` function, additional options, includes the fo
183197

184198
---
185199

186-
We have learned how to stack, replace, and delete activities. Now, let's learn how to create a virtual stack within an activity.
200+
We have learned how to stack, replace, and delete activities. Now, let's learn how to create a virtual stack within an activity.

0 commit comments

Comments
 (0)