Skip to content

Commit 08fcedc

Browse files
committed
Resolve merge conflicts
1 parent 02b8e8e commit 08fcedc

File tree

4 files changed

+9
-79
lines changed

4 files changed

+9
-79
lines changed

.github/workflows/analyze_comment.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,11 @@ on:
66
types:
77
- completed
88

9-
<<<<<<< HEAD
10-
permissions:
11-
pull-requests: write
12-
13-
=======
149
permissions:
1510
contents: read
1611
issues: write
1712
pull-requests: write
1813

19-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
2014
jobs:
2115
comment:
2216
runs-on: ubuntu-latest

src/content/learn/scaling-up-with-reducer-and-context.md

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -509,15 +509,9 @@ export default function TaskApp() {
509509
}
510510

511511
return (
512-
<<<<<<< HEAD
513-
<TasksContext.Provider value={tasks}>
514-
<TasksDispatchContext.Provider value={dispatch}>
515-
<h1>Вихідний день у Кіото</h1>
516-
=======
517512
<TasksContext value={tasks}>
518513
<TasksDispatchContext value={dispatch}>
519-
<h1>Day off in Kyoto</h1>
520-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
514+
<h1>Вихідний день у Кіото</h1>
521515
<AddTask
522516
onAddTask={handleAddTask}
523517
/>
@@ -682,15 +676,9 @@ ul, li { margin: 0; padding: 0; }
682676
Тепер вам не потрібно передавати перелік завдань або обробники подій скрізь усе дерево компонентів:
683677

684678
```js {4-5}
685-
<<<<<<< HEAD
686-
<TasksContext.Provider value={tasks}>
687-
<TasksDispatchContext.Provider value={dispatch}>
688-
<h1>Вихідний день у Кіото</h1>
689-
=======
690679
<TasksContext value={tasks}>
691680
<TasksDispatchContext value={dispatch}>
692-
<h1>Day off in Kyoto</h1>
693-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
681+
<h1>Вихідний день у Кіото</h1>
694682
<AddTask />
695683
<TaskList />
696684
</TasksDispatchContext>
@@ -742,15 +730,9 @@ export default function TaskApp() {
742730
);
743731

744732
return (
745-
<<<<<<< HEAD
746-
<TasksContext.Provider value={tasks}>
747-
<TasksDispatchContext.Provider value={dispatch}>
748-
<h1>Вихідний день у Кіото</h1>
749-
=======
750733
<TasksContext value={tasks}>
751734
<TasksDispatchContext value={dispatch}>
752-
<h1>Day off in Kyoto</h1>
753-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
735+
<h1>Вихідний день у Кіото</h1>
754736
<AddTask />
755737
<TaskList />
756738
</TasksDispatchContext>

src/content/reference/react-dom/createPortal.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,7 @@ export default function ModalContent({ onClose }) {
240240
241241
При використанні порталів, важливо впевнитись, що ваш застосунок залишається доступним для користувачів з обмеженими можливостями. Приміром, вам може знадобитись функціонал для управління фокусом клавіатури, щоб користувач міг переміщати фокус клавіатури в та з порталу у звичний спосіб.
242242
243-
<<<<<<< HEAD
244-
Слідуйте [WAI-ARIA Modal Authoring Practices](https://www.w3.org/WAI/ARIA/apg/#dialog_modal) коли створюєте модальні вікна. Якщо ви використовуєте пакет для модальних вікон від спільноти, переконайтеся, що він відповідає цим рекомендація та доступний користувачам з обмеженими можливостями.
245-
=======
246-
Follow the [WAI-ARIA Modal Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal) when creating modals. If you use a community package, ensure that it is accessible and follows these guidelines.
247-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
243+
Коли розроблюєте модальні вікна, дотримуйтеся відповідних[практик WAI-ARIA](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal). Якщо ви використовуєте пакет для модальних вікон від спільноти, переконайтеся, що він керується цими рекомендаціями та є доступним для всіх.
248244
249245
</Pitfall>
250246

src/content/reference/react/useContext.md

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,13 @@ function MyComponent() {
3838
3939
#### Результат {/*returns*/}
4040
41-
<<<<<<< HEAD
42-
`useContext` повертає значення контексту для компонента, що викликає цей хук. Це значення визначається як `value`, передане найближчому `SomeContext.Provider`, розташованому вище деревом відносно поточного компонента. Якщо такого провайдера немає, повертається значення `defaultValue`, яке ви передали функції [`createContext`](/reference/react/createContext). Повернуте значення завжди актуальне. React автоматично повторно рендерить усі компоненти, що використовують контекст, якщо значення контексту змінюється.
43-
=======
44-
`useContext` returns the context value for the calling component. It is determined as the `value` passed to the closest `SomeContext` above the calling component in the tree. If there is no such provider, then the returned value will be the `defaultValue` you have passed to [`createContext`](/reference/react/createContext) for that context. The returned value is always up-to-date. React automatically re-renders components that read some context if it changes.
45-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
41+
`useContext` повертає значення контексту для компонента, що викликає цей хук. Це значення визначається як `value`, передане найближчому `SomeContext`, розташованому вище деревом відносно поточного компонента. Якщо такого провайдера немає, повертається значення `defaultValue`, яке ви передали функції [`createContext`](/reference/react/createContext). Повернуте значення завжди актуальне. React автоматично повторно рендерить усі компоненти, що використовують контекст, якщо значення контексту змінюється.
4642
4743
#### Застереження {/*caveats*/}
4844
49-
<<<<<<< HEAD
50-
* Eлементи-провайдери не впливають на виклик `useContext()` у компоненті, з якого й повертаються. Відповідний `<Context.Provider>` **повинен бути розташований *вище*** компонента, що викликає `useContext()`.
45+
* Eлементи-провайдери не впливають на виклик `useContext()` у компоненті, з якого й повертаються. Відповідний `<Context>` **повинен бути розташований *вище*** компонента, що викликає `useContext()`.
5146
* React **автоматично оновлює** всі дочірні компоненти, які використовують певний контекст, починаючи з провайдера, що отримує змінене значення `value`. Попереднє та наступне значення порівнюються за допомогою [`Object.is`](https://webdoky.org/uk/docs/Web/JavaScript/Reference/Global_Objects/Object/is/). Пропуск повторних рендерів за допомогою [`memo`](/reference/react/memo) не заважає дочірнім компонентам отримувати оновлене значення контексту.
5247
* Якщо ваша система збирання створює дублікати модулів у вихідному коді (що може статися через символьні посилання), це може порушити контекст. Передавання через контекст працює тільки у разі, якщо `SomeContext` для надання контексту та `SomeContext` для його зчитування є ***точно* тим самим об'єктом**, що визначається порівнянням `===`.
53-
=======
54-
* `useContext()` call in a component is not affected by providers returned from the *same* component. The corresponding `<Context>` **needs to be *above*** the component doing the `useContext()` call.
55-
* React **automatically re-renders** all the children that use a particular context starting from the provider that receives a different `value`. The previous and the next values are compared with the [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) comparison. Skipping re-renders with [`memo`](/reference/react/memo) does not prevent the children receiving fresh context values.
56-
* If your build system produces duplicates modules in the output (which can happen with symlinks), this can break context. Passing something via context only works if `SomeContext` that you use to provide context and `SomeContext` that you use to read it are ***exactly* the same object**, as determined by a `===` comparison.
57-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
5848
5949
---
6050
@@ -1111,17 +1101,10 @@ export default function MyApp() {
11111101
11121102
function Form() {
11131103
return (
1114-
<<<<<<< HEAD
11151104
<Panel title="Ласкаво просимо">
11161105
<Button>Зареєструватися</Button>
11171106
<Button>Увійти</Button>
1118-
<ThemeContext.Provider value="light">
1119-
=======
1120-
<Panel title="Welcome">
1121-
<Button>Sign up</Button>
1122-
<Button>Log in</Button>
11231107
<ThemeContext value="light">
1124-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
11251108
<Footer />
11261109
</ThemeContext>
11271110
</Panel>
@@ -1366,28 +1349,17 @@ function MyApp() {
13661349

13671350
Існує кілька поширених причин, чому це може статися:
13681351

1369-
<<<<<<< HEAD
1370-
1. Ви розміщуєте `<SomeContext.Provider>` у тому ж компоненті або нижче, ніж компонент, де викликано `useContext()`. Перемістіть `<SomeContext.Provider>` *вище і зовні* компонента, який викликає `useContext()`.
1371-
2. Можливо, ви забули обгорнути свій компонент у `<SomeContext.Provider>` або розмістили його в іншій, ніж задумали, частині дерева. Переконайтеся за допомогою [React DevTools](/learn/react-developer-tools), що ієрархія компонентів налаштована правильно.
1352+
1. Ви розміщуєте `<SomeContext>` у тому ж компоненті або нижче, ніж компонент, де викликано `useContext()`. Перемістіть `<SomeContext>` *вище і зовні* компонента, який викликає `useContext()`.
1353+
2. Можливо, ви забули обгорнути свій компонент у `<SomeContext>` або розмістили його в іншій, ніж задумали, частині дерева. Переконайтеся за допомогою [React DevTools](/learn/react-developer-tools), що ієрархія компонентів налаштована правильно.
13721354
3. Можливо, ви зіткнулися з проблемою збирання, через яку `SomeContext` із компонента-провайдера і `SomeContext` компонента-читача є різними об'єктами. Це може статися, наприклад, якщо ви використовуєте символьні посилання. Можете перевірити це, присвоївши їх глобальним змінним, як-от `window.SomeContext1` і `window.SomeContext2`, а потім порівняти `window.SomeContext1 === window.SomeContext2` в консолі. Якщо вони не тотожні, виправте цю проблему на рівні збирання.
1373-
=======
1374-
1. You're rendering `<SomeContext>` in the same component (or below) as where you're calling `useContext()`. Move `<SomeContext>` *above and outside* the component calling `useContext()`.
1375-
2. You may have forgotten to wrap your component with `<SomeContext>`, or you might have put it in a different part of the tree than you thought. Check whether the hierarchy is right using [React DevTools.](/learn/react-developer-tools)
1376-
3. You might be running into some build issue with your tooling that causes `SomeContext` as seen from the providing component and `SomeContext` as seen by the reading component to be two different objects. This can happen if you use symlinks, for example. You can verify this by assigning them to globals like `window.SomeContext1` and `window.SomeContext2` and then checking whether `window.SomeContext1 === window.SomeContext2` in the console. If they're not the same, fix that issue on the build tool level.
1377-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
13781355
13791356
### Я завжди отримую `undefined` із контексту, хоча початкове значення інше {/*i-am-always-getting-undefined-from-my-context-although-the-default-value-is-different*/}
13801357
13811358
Можливо, у вас є провайдер без `value` у дереві:
13821359
13831360
```js {1,2}
1384-
<<<<<<< HEAD
13851361
// 🚩 Не працює: немає пропа value
1386-
<ThemeContext.Provider>
1387-
=======
1388-
// 🚩 Doesn't work: no value prop
13891362
<ThemeContext>
1390-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
13911363
<Button />
13921364
</ThemeContext>
13931365
```
@@ -1397,33 +1369,19 @@ function MyApp() {
13971369
Також, можливо, ви випадково застосували помилкову назву пропа:
13981370
13991371
```js {1,2}
1400-
<<<<<<< HEAD
14011372
// 🚩 Не працює: проп має називатися "value"
1402-
<ThemeContext.Provider theme={theme}>
1403-
=======
1404-
// 🚩 Doesn't work: prop should be called "value"
14051373
<ThemeContext theme={theme}>
1406-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
14071374
<Button />
14081375
</ThemeContext>
14091376
```
14101377
14111378
В обох випадках React покаже попередження у консолі. Щоб виправити це, назвіть проп `value`:
14121379
14131380
```js {1,2}
1414-
<<<<<<< HEAD
14151381
// ✅ Передача пропа value
1416-
<ThemeContext.Provider value={theme}>
1417-
=======
1418-
// ✅ Passing the value prop
14191382
<ThemeContext value={theme}>
1420-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
14211383
<Button />
14221384
</ThemeContext>
14231385
```
14241386
1425-
<<<<<<< HEAD
1426-
Зверніть увагу, що [початкове значення, яке ви передали у `createContext(defaultValue)`](#specifying-a-fallback-default-value), застосовується, **тільки якщо вище в ієрархії не знайдено жодного провайдера.** Якщо в будь-якому місці дерева батьківських компонентів є `<SomeContext.Provider value={undefined}>`, компонент, що викликає `useContext(SomeContext)`, *отримає* `undefined` як значення контексту.
1427-
=======
1428-
Note that the [default value from your `createContext(defaultValue)` call](#specifying-a-fallback-default-value) is only used **if there is no matching provider above at all.** If there is a `<SomeContext value={undefined}>` component somewhere in the parent tree, the component calling `useContext(SomeContext)` *will* receive `undefined` as the context value.
1429-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
1387+
Зверніть увагу, що [початкове значення, яке ви передали у `createContext(defaultValue)`](#specifying-a-fallback-default-value), застосовується, **тільки якщо вище в ієрархії не знайдено жодного провайдера.** Якщо в будь-якому місці дерева батьківських компонентів є `<SomeContext value={undefined}>`, компонент, що викликає `useContext(SomeContext)`, *отримає* `undefined` як значення контексту.

0 commit comments

Comments
 (0)