-
Notifications
You must be signed in to change notification settings - Fork 127
docs(uk): translate useCallback.md to Ukrainian #634
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Resolved conflict in useCallback.md by keeping Ukrainian translation content
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.
Дякую за PR!
Це перша частина перевірки. Було перевірено деякі найпоширеніші слововживання.
Запити на зміни мають бути виправлені і перевірені у всій статті до того, як я почну вичитувати текст у наступних частинах перевірки, щоб зменшити кількість когнітивного навантаження від коректури та редактури того самого. Немає вимог, коли має бути виправлено, це буде просто послідовна асинхронна взаємодія перевірка-зміни-перевірка-зміни-перевірка тощо.
|
|
||
| [React Compiler](/learn/react-compiler) automatically memoizes values and functions, reducing the need for manual `useCallback` calls. You can use the compiler to handle memoization automatically. | ||
|
|
||
| [React Compiler](/learn/react-compiler) автоматично мемоізує значення та функції, зменшуючи потребу у ручних викликах `useCallback`. Ви можете використовувати компілятор, щоб автоматично керувати мемоізацією. |
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.
- мемоїзувати (українській не властиво дві голосні підряд, треба між ними приголосний звук, саме так проект і став проєктом)
змінити тут і далі
| #### Параметри {/*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 поверне (але не викличе!) вашу функцію під час початкового рендеру. При наступних рендерах React надасть вам ту саму функцію знову, якщо `dependencies` не змінилися з попереднього рендеру. Інакше він надасть вам функцію, яку ви передали під час поточного рендеру, і збереже її на випадок, якщо її можна буде використати пізніше. React не викличе вашу функцію. Функція повертається вам, щоб ви могли вирішити, коли і чи викликати її. |
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.
- тут і далі: виправити вживання при https://onlinecorrector.com.ua/%D0%B1%D1%96%D0%BB%D1%8F-%D0%BA%D1%80%D0%B0%D0%B9-%D0%B7%D0%B0-%D0%BF%D1%96%D0%B4-%D1%87%D0%B0%D1%81-%D1%83-%D1%80%D0%B0%D0%B7%D1%96/ - воно не настільки властиве українській, зазвичай у цих текстах воно перекладатиметься як "під час", "за", "у"
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.
fixed
| * `fn`: Функція, яку ви хочете кешувати. Вона може приймати будь-які аргументи та повертати будь-які значення. React поверне (але не викличе!) вашу функцію під час початкового рендеру. При наступних рендерах React надасть вам ту саму функцію знову, якщо `dependencies` не змінилися з попереднього рендеру. Інакше він надасть вам функцію, яку ви передали під час поточного рендеру, і збереже її на випадок, якщо її можна буде використати пізніше. React не викличе вашу функцію. Функція повертається вам, щоб ви могли вирішити, коли і чи викликати її. | ||
| * `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. | ||
| * `dependencies`: Список усіх реактивних значень, на які посилається код `fn`. Реактивні значення включають пропси, стан та всі змінні та функції, оголошені безпосередньо всередині тіла вашого компонента. Якщо ваш лінтер [налаштований для React](/learn/editor-setup#linting), він перевірить, що кожне реактивне значення правильно вказано як залежність. Список залежностей повинен мати постійну кількість елементів і бути написаним вбудованим способом, як `[dep1, dep2, dep3]`. React порівняє кожну залежність з її попереднім значенням, використовуючи алгоритм порівняння [`Object.is`](https://webdoky.org/uk/docs/Web/JavaScript/Reference/Global_Objects/Object/is). |
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.
- включати => містять https://community.languagetool.org/rule/show/VKLYUCHATY_VS_MISTYTY?lang=uk&subId=2, але тут навіть краще було б "реактивними є" (і без значень, щоб трохи менше тавтології)
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.
fixed
| * `useCallback` is a Hook, so you can only call it **at the top level of your component** or your own Hooks. You can't call it inside loops or conditions. If you need that, extract a new component and move the state into it. | ||
| * React **will not throw away the cached function unless there is a specific reason to do that.** For example, in development, React throws away the cache when you edit the file of your component. Both in development and in production, React will throw away the cache if your component suspends during the initial mount. In the future, React may add more features that take advantage of throwing away the cache--for example, if React adds built-in support for virtualized lists in the future, it would make sense to throw away the cache for items that scroll out of the virtualized table viewport. This should match your expectations if you rely on `useCallback` as a performance optimization. Otherwise, a [state variable](/reference/react/useState#im-trying-to-set-state-to-a-function-but-it-gets-called-instead) or a [ref](/reference/react/useRef#avoiding-recreating-the-ref-contents) may be more appropriate. | ||
| * `useCallback` — це хук, тому ви можете викликати його лише **на верхньому рівні вашого компонента** або ваших власних хуків. Ви не можете викликати його всередині циклів або умов. Якщо вам це потрібно, винесіть новий компонент і перенесіть стан до нього. |
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.
| * `useCallback` — це хук, тому ви можете викликати його лише **на верхньому рівні вашого компонента** або ваших власних хуків. Ви не можете викликати його всередині циклів або умов. Якщо вам це потрібно, винесіть новий компонент і перенесіть стан до нього. | |
| * `useCallback` — це хук, тому ви можете викликати його лише **на верхньому рівні вашого компонента** або ваших власних хуків. Ви не можете викликати його всередині циклів або умов. Якщо вам це потрібно, винесіть новий компонент і перенесіть стан до нього. | |
зберігаємо оригінальний порядок
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.
fixed
| const [count, setCount] = useState(1); | ||
|
|
||
| console.log('[ARTIFICIALLY SLOW] Rendering <ShippingForm />'); | ||
| console.log('[ШТУЧНО СПОВІЛЬНЕНО] Рендер <ShippingForm />'); |
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.
| console.log('[ШТУЧНО СПОВІЛЬНЕНО] Рендер <ShippingForm />'); | |
| console.log('[ШТУЧНО СПОВІЛЬНЕНО] Рендеринг <ShippingForm />'); |
змінити тут і далі, щоб був акцент саме на процесі
Дякую, я вніс зміни та виправив помилки, на які ви вказали. Повертаю статтю вам і чекаю на наступну частину перевірки |
This PR adds the Ukrainian translation for the "useCallback" page (useCallback.md) in the React documentation.
I'm just starting out, so please be more careful with feedback. I'd be grateful for any input.