diff --git a/docs/pages/docs/get-started/navigating-activities.en.mdx b/docs/pages/docs/get-started/navigating-activities.en.mdx index 226d618a3..9375e4cc5 100644 --- a/docs/pages/docs/get-started/navigating-activities.en.mdx +++ b/docs/pages/docs/get-started/navigating-activities.en.mdx @@ -169,23 +169,23 @@ const Article: ActivityComponentType = ({ params }) => { export default Article; ``` -`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. +`pop()` takes optional parameters for the number of activities to pop and additional options. These parameters can be omitted, and default values will be used. ```ts -pop(); // pop a single stack +pop(); // pop a single activity -pop(3); // pop multiple stacks +pop(3); // pop multiple activities pop({ /* additional option */ -}); // pop a single stack with additional options +}); // pop a single activity with additional options pop(3, { /* additional option */ -}); // pop multiple stacks with additional options +}); // pop multiple activities with additional options ``` -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. +The first parameter of the pop() function can specify the number of activities to pop or define additional options. If the first parameter is used for the number of activities, the second parameter can then be used to provide additional options. The additional options include the following values. diff --git a/docs/pages/docs/get-started/navigating-activities.ko.mdx b/docs/pages/docs/get-started/navigating-activities.ko.mdx index 3754ca999..1b0d21d14 100644 --- a/docs/pages/docs/get-started/navigating-activities.ko.mdx +++ b/docs/pages/docs/get-started/navigating-activities.ko.mdx @@ -135,10 +135,7 @@ replace( 마지막으로 현재 액티비티를 삭제하고 이전 액티비티로 돌아가는 방법에 대해서 살펴봐요. `stackflow.ts`에서 생성했던 `useFlow()` 훅의 `pop()` 함수를 통해 다음과 같이 현재 액티비티를 삭제할 수 있어요. -```tsx -/** - * Article.tsx - */ +```tsx showLineNumbers filename="Article.tsx" copy /pop/ import { ActivityComponentType } from "@stackflow/react"; import { AppScreen } from "@stackflow/plugin-basic-ui"; import { useFlow } from "./stackflow"; @@ -150,15 +147,22 @@ type ArticleParams = { const Article: ActivityComponentType = ({ params }) => { const { pop } = useFlow(); - const onClick = () => { + const goBack = () => { + // 액티비티 하나만 제거 pop(); }; + const goBackMultiple = () => { + // 액티비티 여러 개 제거 + pop(3); + }; + return (

{params.title}

- + +
); @@ -167,15 +171,21 @@ const Article: ActivityComponentType = ({ params }) => { export default Article; ``` -`pop()`은 첫번째 파라미터로 추가 옵션을 받아요. 첫번째 파라미터인 추가 옵션은 선택적으로 넘기지 않을 수 있어요. (기본값을 사용해요) +`pop()` 함수의 첫번째 파라미터는 제거할 액티비티의 개수를 지정하거나 추가 옵션을 정의할 수 있어요. +첫번째 파라미터를 액티비티 개수로 사용하면, 두번째 매개변수는 추가 옵션을 전달하는 데 사용할 수 있어요. ```ts -pop(); +pop(); // 액티비티 하나 제거 + +pop(3); // 액티비티 여러 개 제거 -// 또는 pop({ /* 추가 옵션 */ -}); +}); // 추가 옵션과 함께 액티비티 하나 제거 + +pop(3, { + /* 추가 옵션 */ +}); // 추가 옵션과 함께 액티비티 여러 개 제거 ``` `pop()` 함수의 첫번째 파라미터인 추가 옵션에는 다음과 같은 값이 있어요. @@ -188,4 +198,4 @@ pop({ --- -액티비티를 쌓고, 교체하고, 삭제하는 방법에 대해서 알아봤어요. 이제 액티비티 내의 가상의 스택을 만들 수 있는 방법에 대해 알아봐요. \ No newline at end of file +액티비티를 쌓고, 교체하고, 삭제하는 방법에 대해서 알아봤어요. 이제 액티비티 내의 가상의 스택을 만들 수 있는 방법에 대해 알아봐요.