Skip to content
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

Finished translation of "Scaling up with reducer and context" #561

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

astropsy999
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Aug 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
uk-legacy-reactjs-org ⬜️ Ignored (Inspect) Visit Preview Feb 2, 2025 7:47pm

Copy link

github-actions bot commented Aug 18, 2024

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 125.52 KB (🟡 +37 B) 235.9 KB
/500 125.53 KB (🟡 +37 B) 235.91 KB
/[[...markdownPath]] 127.51 KB (🟡 +37 B) 237.89 KB
/errors 125.8 KB (🟡 +37 B) 236.18 KB
/errors/[errorCode] 125.78 KB (🟡 +37 B) 236.16 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Copy link
Collaborator

@alinkedd alinkedd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На цьому тижні передивлюсь цей PR

src/content/reference/react/useContext.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@alinkedd alinkedd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Перша частина перевірки: усі ці зауваження мають бути виправлені у всьому PR.

Друга частина перевірки буде після злиття #560 і виправлень першої частини перевірки - інакше у мене накладається складність коректури одного і того ж

src/content/learn/scaling-up-with-reducer-and-context.md Outdated Show resolved Hide resolved
src/content/learn/scaling-up-with-reducer-and-context.md Outdated Show resolved Hide resolved
src/content/learn/scaling-up-with-reducer-and-context.md Outdated Show resolved Hide resolved
src/content/learn/scaling-up-with-reducer-and-context.md Outdated Show resolved Hide resolved
src/content/learn/scaling-up-with-reducer-and-context.md Outdated Show resolved Hide resolved
src/content/learn/scaling-up-with-reducer-and-context.md Outdated Show resolved Hide resolved
@alinkedd
Copy link
Collaborator

@astropsy999 можеш ребейзнути?

* How to combine a reducer with context
* How to avoid passing state and dispatch through props
* How to keep context and state logic in a separate file
* Як поєднати з контекстом
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Як поєднати з контекстом
* Як поєднати редюсер із контекстом

* How to avoid passing state and dispatch through props
* How to keep context and state logic in a separate file
* Як поєднати з контекстом
* Як уникнути передачі стану та диспатча через пропси
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Як уникнути передачі стану та диспатча через пропси
* Як уникнути передавання стану та відправляння подій через пропси

передача -> передавання
https://onlinecorrector.com.ua/%D0%BF%D0%B5%D1%80%D0%B5%D0%B4%D0%B0%D0%B2%D0%B0%D0%BD%D0%BD%D1%8F/


In this example from [the introduction to reducers](/learn/extracting-state-logic-into-a-reducer), the state is managed by a reducer. The reducer function contains all of the state update logic and is declared at the bottom of this file:
Як ми вже бачили, у прикладі з [цього розділу](/learn/extracting-state-logic-into-a-reducer), стан керується редюсером. Функція редюсера містить всю логіку оновлення стану і оголошена в кінці файлу:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Як ми вже бачили, у прикладі з [цього розділу](/learn/extracting-state-logic-into-a-reducer), стан керується редюсером. Функція редюсера містить всю логіку оновлення стану і оголошена в кінці файлу:
Як ми вже бачили у прикладі з [цього розділу](/learn/extracting-state-logic-into-a-reducer), стан керується редюсером. Функція редюсера містить всю логіку оновлення стану і оголошена в кінці файлу:

@@ -207,9 +207,9 @@ ul, li { margin: 0; padding: 0; }

</Sandpack>

A reducer helps keep the event handlers short and concise. However, as your app grows, you might run into another difficulty. **Currently, the `tasks` state and the `dispatch` function are only available in the top-level `TaskApp` component.** To let other components read the list of tasks or change it, you have to explicitly [pass down](/learn/passing-props-to-a-component) the current state and the event handlers that change it as props.
Редюсер допомагає тримати обробники подій короткими і зрозумілими. Проте, з розвитком вашого додатка може виникнути проблема. **Наразі стан `tasks` та функція `dispatch` доступні тільки в компоненті `TaskApp` на верхньому рівні.** Щоб інші компоненти могли отримувати та оновлювати перелік завдань, потрібно явно [передавати](#passing-props-to-a-component) пропсами поточний стан і обробники подій.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Редюсер допомагає тримати обробники подій короткими і зрозумілими. Проте, з розвитком вашого додатка може виникнути проблема. **Наразі стан `tasks` та функція `dispatch` доступні тільки в компоненті `TaskApp` на верхньому рівні.** Щоб інші компоненти могли отримувати та оновлювати перелік завдань, потрібно явно [передавати](#passing-props-to-a-component) пропсами поточний стан і обробники подій.
Редюсер допомагає тримати обробники подій короткими і зрозумілими. Проте може виникнути проблема, коли ваш застосунок зросте. **Наразі стан `tasks` та функція `dispatch` доступні тільки в компоненті `TaskApp` на верхньому рівні.** Щоб інші компоненти могли отримувати та оновлювати перелік завдань, потрібно явно [передавати](#passing-props-to-a-component) поточний стан і обробники подій, які змінюють його, як пропси.

додаток -> застосунок
https://onlinecorrector.com.ua/%D0%B7%D0%B0%D1%81%D1%82%D0%BE%D1%81%D1%83%D0%BD%D0%BE%D0%BA-%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B0/

@@ -229,30 +229,30 @@ And `TaskList` passes the event handlers to `Task`:
/>
```

In a small example like this, this works well, but if you have tens or hundreds of components in the middle, passing down all state and functions can be quite frustrating!
У невеликому прикладі це добре працює, але якщо у вас є десятки або сотні вкладених компонентів, передавати таким чином весь стан і функції може бути досить неприємно!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
У невеликому прикладі це добре працює, але якщо у вас є десятки або сотні вкладених компонентів, передавати таким чином весь стан і функції може бути досить неприємно!
У невеликому прикладі це працює добре, але якщо у вас є десятки або сотні вкладених компонентів, передавати так увесь стан і функції може бути досить неприємно!

таким чином -> так
https://onlinecorrector.com.ua/%D0%BE%D1%82%D0%B6%D0%B5-%D1%83-%D1%82%D0%B0%D0%BA%D0%B8%D0%B9-%D1%81%D0%BF%D0%BE%D1%81%D1%96%D0%B1/

- You can export a component like `TasksProvider` that provides context.
- You can also export custom Hooks like `useTasks` and `useTasksDispatch` to read it.
- You can have many context-reducer pairs like this in your app.
- Ви можете об'єднати редюсер з контекстом, щоб будь-який компонент міг мати доступ та оновлювати стан у компонентах вищих за ієрархією.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Ви можете об'єднати редюсер з контекстом, щоб будь-який компонент міг мати доступ та оновлювати стан у компонентах вищих за ієрархією.
- Ви можете об'єднати редюсер із контекстом, щоб будь-який компонент міг отримати та оновити стан, що вище деревом.

- Щоб надати стан і функцію `dispatch` компонентам нижче:
1. Створіть два контексти (для стану і для функцій `dispatch`).
2. Надайте обидва контексти компоненту, який використовує редюсер.
3. Використовуйте будь-який контекст у компонентах, яким потрібно мати ці дані.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. Використовуйте будь-який контекст у компонентах, яким потрібно мати ці дані.
3. Використовуйте будь-який із цих контекстів у компонентах, яким вони потрібні.

1. Створіть два контексти (для стану і для функцій `dispatch`).
2. Надайте обидва контексти компоненту, який використовує редюсер.
3. Використовуйте будь-який контекст у компонентах, яким потрібно мати ці дані.
- Щоб ще більше спростити компоненти, виносьте ці налаштування в один файл.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Щоб ще більше спростити компоненти, виносьте ці налаштування в один файл.
- Щоб ще більше спростити компоненти, винесіть відповідну логіку в один файл.

3. Використовуйте будь-який контекст у компонентах, яким потрібно мати ці дані.
- Щоб ще більше спростити компоненти, виносьте ці налаштування в один файл.
- Експортуйте компонент, наприклад `TasksProvider`, який надає контекст.
- Ви також можете експортувати користувацькі хуки, як-от `useTasks` та `useTasksDispatch`, для доступу до контексту.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Ви також можете експортувати користувацькі хуки, як-от `useTasks` та `useTasksDispatch`, для доступу до контексту.
- Ви також можете експортувати хуки користувача, як-от `useTasks` та `useTasksDispatch`, для доступу до контексту.

- Щоб ще більше спростити компоненти, виносьте ці налаштування в один файл.
- Експортуйте компонент, наприклад `TasksProvider`, який надає контекст.
- Ви також можете експортувати користувацькі хуки, як-от `useTasks` та `useTasksDispatch`, для доступу до контексту.
- У додатку може бути багато схожих на цю пар контекст-редюсерів.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- У додатку може бути багато схожих на цю пар контекст-редюсерів.
- У застосунку може бути багато схожих на цю пар "контекст-редюсер".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants