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/cacheSignal.md
+22-22Lines changed: 22 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@ title: cacheSignal
4
4
5
5
<RSC>
6
6
7
-
`cacheSignal` is currently only used with [React Server Components](/blog/2023/03/22/react-labs-what-we-have-been-working-on-march-2023#react-server-components).
7
+
`cacheSignal`은 현재 [React 서버 컴포넌트](/blog/2023/03/22/react-labs-what-we-have-been-working-on-march-2023#react-server-components)에서만 사용할 수 있습니다.
8
8
9
9
</RSC>
10
10
11
11
<Intro>
12
12
13
-
`cacheSignal` allows you to know when the `cache()`lifetime is over.
13
+
`cacheSignal`을 사용하면 `cache()`수명이 언제 끝나는지 알 수 있습니다.
14
14
15
15
```js
16
16
constsignal=cacheSignal();
@@ -22,11 +22,11 @@ const signal = cacheSignal();
22
22
23
23
---
24
24
25
-
## Reference {/*reference*/}
25
+
## 레퍼런스 {/*reference*/}
26
26
27
27
### `cacheSignal` {/*cachesignal*/}
28
28
29
-
Call `cacheSignal` to get an `AbortSignal`.
29
+
`cacheSignal`을 호출하면 `AbortSignal`을 얻을 수 있습니다.
30
30
31
31
```js {3,7}
32
32
import {cacheSignal} from'react';
@@ -35,32 +35,32 @@ async function Component() {
35
35
}
36
36
```
37
37
38
-
When React has finished rendering, the `AbortSignal` will be aborted. This allows you to cancel any in-flight work that is no longer needed.
39
-
Rendering is considered finished when:
40
-
-React has successfully completed rendering
41
-
-the render was aborted
42
-
-the render has failed
38
+
React가 렌더링을 완료하면 `AbortSignal`이 중단됩니다. 이를 통해 더 이상 필요하지 않은 진행 중인 작업을 취소할 수 있습니다.
39
+
렌더링이 완료된 것으로 간주하는 경우는 다음과 같습니다.
40
+
-React가 성공적으로 렌더링을 완료한 경우
41
+
-렌더링이 중단된 경우
42
+
-렌더링이 실패한 경우
43
43
44
-
#### Parameters {/*parameters*/}
44
+
#### 매개변수 {/*parameters*/}
45
45
46
-
This function does not accept any parameters.
46
+
이 함수는 매개변수를 받지 않습니다.
47
47
48
-
#### Returns {/*returns*/}
48
+
#### 반환값 {/*returns*/}
49
49
50
-
`cacheSignal` returns an `AbortSignal` if called during rendering. Otherwise `cacheSignal()` returns `null`.
50
+
`cacheSignal`은 렌더링 중에 호출되면 `AbortSignal`을 반환합니다. 그 외의 경우에 `cacheSignal()`은 `null`을 반환합니다.
51
51
52
-
#### Caveats {/*caveats*/}
52
+
#### 주의사항 {/*caveats*/}
53
53
54
-
-`cacheSignal` is currently for use in [React Server Components](/reference/rsc/server-components) only. In Client Components, it will always return `null`. In the future it will also be used for Client Component when a client cache refreshes or invalidates. You should not assume it'll always be null on the client.
55
-
-If called outside of rendering, `cacheSignal` will return `null` to make it clear that the current scope isn't cached forever.
54
+
-`cacheSignal`은 현재 [React 서버 컴포넌트](/reference/rsc/server-components)에서만 사용할 수 있습니다. 클라이언트 컴포넌트에서는 항상 `null`을 반환합니다. 향후 클라이언트 캐시가 갱신되거나 무효화될 때 클라이언트 컴포넌트에서도 사용될 예정입니다. 클라이언트에서 항상 `null`을 반환한다고 가정하면 안 됩니다.
55
+
-렌더링 외부에서 호출하면 `cacheSignal`은 `null`을 반환하여 현재 스코프가 영원히 캐시되지 않음을 명확히 합니다.
Call <CodeStepstep={1}>`cacheSignal`</CodeStep> to abort in-flight requests.
63
+
<CodeStepstep={1}>`cacheSignal`</CodeStep>을 호출하여 진행 중인 요청을 중단할 수 있습니다.
64
64
65
65
```js [[1, 4, "cacheSignal()"]]
66
66
import {cache, cacheSignal} from'react';
@@ -71,7 +71,7 @@ async function Component() {
71
71
```
72
72
73
73
<Pitfall>
74
-
You can't use `cacheSignal` to abort async work that was started outside of rendering e.g.
74
+
아래의 예시처럼 렌더링 외부에서 시작된 비동기 작업을 `cacheSignal`로 중단할 수 없습니다.
75
75
76
76
```js
77
77
import {cacheSignal} from'react';
@@ -83,9 +83,9 @@ async function Component() {
83
83
```
84
84
</Pitfall>
85
85
86
-
### Ignore errors after React has finished rendering {/*ignore-errors-after-react-has-finished-rendering*/}
86
+
### React가 렌더링을 완료한 후 오류 무시하기 {/*ignore-errors-after-react-has-finished-rendering*/}
87
87
88
-
If a function throws, it may be due to cancellation (e.g. <CodeStepstep={1}>the Database connection</CodeStep> has been closed). You can use the <CodeStepstep={2}>`aborted`property</CodeStep> to check if the error was due to cancellation or a real error. You may want to <CodeStepstep={3}>ignore errors</CodeStep> that were due to cancellation.
88
+
함수가 오류를 던지는 경우 취소로 인한 것일 수 있습니다. (예를 들어, <CodeStepstep={1}>데이터베이스 연결</CodeStep>이 닫힌 경우) <CodeStepstep={2}>`aborted`속성</CodeStep>을 사용하여 오류가 취소로 인한 것인지 실제 오류인지 확인할 수 있습니다. 취소로 인한 <CodeStepstep={3}>오류는 무시할 수 있습니다</CodeStep>.
0 commit comments