-
-
Notifications
You must be signed in to change notification settings - Fork 468
Translate : useCallback #612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
2d25fb5
d72fdd5
dfa8ee1
8006c5a
f4264d1
60adefd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ title: useCallback | |
|
||
<Intro> | ||
|
||
`useCallback` is a React Hook that lets you cache a function definition between re-renders. | ||
`useCallback`은 리렌더링 사이에 함수 정의를 캐시할 수 있게 해주는 React Hook입니다. | ||
|
||
```js | ||
const cachedFn = useCallback(fn, dependencies) | ||
|
@@ -16,11 +16,11 @@ const cachedFn = useCallback(fn, dependencies) | |
|
||
--- | ||
|
||
## Reference {/*reference*/} | ||
## 문서 {/*reference*/} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Glossary 에 명시된 대로 |
||
|
||
### `useCallback(fn, dependencies)` {/*usecallback*/} | ||
|
||
Call `useCallback` at the top level of your component to cache a function definition between re-renders: | ||
컴포넌트의 최상위 레벨에서 useCallback을 호출하여 리렌더링 간 함수 선언 캐시하세요. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 함수 선언 캐시 → 함수 선언을 캐시 |
||
|
||
```js {4,9} | ||
import { useCallback } from 'react'; | ||
|
@@ -36,9 +36,9 @@ export default function ProductPage({ productId, referrer, theme }) { | |
|
||
[See more examples below.](#usage) | ||
|
||
#### Parameters {/*parameters*/} | ||
#### 매개변수 {/*parameters*/} | ||
|
||
* `fn`: The function value that you want to cache. It can take any arguments and return any values. React will return (not call!) your function back to you during the initial render. On next renders, React will give you the same function again if the `dependencies` have not changed since the last render. Otherwise, it will give you the function that you have passed during the current render, and store it in case it can be reused later. React will not call your function. The function is returned to you so you can decide when and whether to call it. | ||
* `fn`: 캐시하려는 함수입니다. 어떠한 인를 취하고 어떠한 값을 반환할 수 있습니다. React는 초기 렌더링 중에 함수를 반환(호출하지 않음)합니다. 다음 렌더링할 때, `dependencies`가 마지막 렌더링 이후 변경되지 않은 경우 React는 동일한 함수를 다시 반환합니다. 변경되었다면, React는 현재 렌더링 중에 전달한 함수를 반환하고 나중에 재사용할 수 있는지 확인하기 위해 저장합니다. React는 함수를 호출하지 않습니다. 함수는 호출할 시기와 여부를 결정할 수 있도록 반환됩니다. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
* `dependencies`: The list of all reactive values referenced inside of the `fn` code. Reactive values include props, state, and all the variables and functions declared directly inside your component body. If your linter is [configured for React](/learn/editor-setup#linting), it will verify that every reactive value is correctly specified as a dependency. The list of dependencies must have a constant number of items and be written inline like `[dep1, dep2, dep3]`. React will compare each dependency with its previous value using the [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) comparison algorithm. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hook 은
훅
으로 번역 부탁드립니다https://github.com/reactjs/ko.react.dev/wiki/Translate-Glossary