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/learn/sharing-state-between-components.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,31 @@
1
1
---
2
-
title: Sharing State Between Components
2
+
title: Спільний доступ до стану між компонентами
3
3
---
4
4
5
5
<Intro>
6
6
7
-
Sometimes, you want the state of two components to always change together. To do it, remove state from both of them, move it to their closest common parent, and then pass it down to them via props. This is known as *lifting state up,* and it's one of the most common things you will do writing React code.
7
+
Інколи ви хочете, щоб стан двох компонентів завжди змінювався разом. Щоб так зробити, видаліть стан з обох компонентів, перенесіть його до їхнього найближчого спільного батька та потім передайте його вниз до них завдяки пропсам. Це відоме як *підняття стану вгору* і це одна з найпоширеніших речей, які ви будете робити під час написання React коду.
8
8
9
9
</Intro>
10
10
11
11
<YouWillLearn>
12
12
13
-
-How to share state between components by lifting it up
14
-
-What are controlled and uncontrolled components
13
+
-Як поширювати стан між компонент підняттям його вгору
14
+
-Що таке контрольовані та не контрольовані компоненти
15
15
16
16
</YouWillLearn>
17
17
18
-
## Lifting state up by example {/*lifting-state-up-by-example*/}
18
+
## Підняття стану на прикладі {/*lifting-state-up-by-example*/}
19
19
20
-
In this example, a parent `Accordion`component renders two separate`Panel`s:
20
+
В цьому прикладі, батьківський `Accordion`компонента рендерить дві окремі`Panel`і:
21
21
22
22
*`Accordion`
23
23
-`Panel`
24
24
-`Panel`
25
25
26
-
Each`Panel`component has a boolean `isActive`state that determines whether its content is visible.
26
+
Кожна`Panel`компонента має булевий `isActive`стан, що визначає чи її вміст видимий.
27
27
28
-
Press the Show button for both panels:
28
+
Натисніть кнопку Показати для обох панелей:
29
29
30
30
<Sandpack>
31
31
@@ -41,7 +41,7 @@ function Panel({ title, children }) {
41
41
<p>{children}</p>
42
42
) : (
43
43
<button onClick={() =>setIsActive(true)}>
44
-
Show
44
+
Показати
45
45
</button>
46
46
)}
47
47
</section>
@@ -51,12 +51,12 @@ function Panel({ title, children }) {
51
51
exportdefaultfunctionAccordion() {
52
52
return (
53
53
<>
54
-
<h2>Almaty, Kazakhstan</h2>
55
-
<Panel title="About">
56
-
With a population of about 2 million, Almaty is Kazakhstan's largest city. From 1929 to 1997, it was its capital city.
54
+
<h2>Алмати, Казахстан</h2>
55
+
<Panel title="Про Алмати">
56
+
Із населенням близько 2 мільйонів, Алмати є найбільшим містом в Казахстані. З1929по1997, воно було його столицею.
57
57
</Panel>
58
-
<Panel title="Etymology">
59
-
The name comes from <span lang="kk-KZ">алма</span>, the Kazakh word for "apple" and is often translated as "full of apples". In fact, the region surrounding Almaty is thought to be the ancestral home of the apple, and the wild <i lang="la">Malus sieversii</i> is considered a likely candidate for the ancestor of the modern domestic apple.
58
+
<Panel title="Етимологія">
59
+
Назва походить від казахського слова <span lang="kk-KZ">алма</span>, що означає "яблуко" і часто перекладалось як "повний яблук". Насправді, регіон що оточує Алмати вважається прабатьківщиною яблука, і дика <i lang="la">Malus sieversii</i>вважається ймовірним кандидатом на предка сучасного домашнього яблука.
0 commit comments