Skip to content

Commit 827d6a2

Browse files
authored
Merge pull request #45 from reactjs/sync-a0cacd7d
Sync with react.dev @ a0cacd7
2 parents cb77969 + 6c6175f commit 827d6a2

22 files changed

+664
-22
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
11.7 KB
Loading
12.3 KB
Loading

src/content/community/meetups.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
4848
* [Montreal, QC - React Native](https://www.meetup.com/fr-FR/React-Native-MTL/)
4949
* [Vancouver, BC](https://www.meetup.com/ReactJS-Vancouver-Meetup/)
5050
* [Ottawa, ON](https://www.meetup.com/Ottawa-ReactJS-Meetup/)
51+
* [Saskatoon, SK](https://www.meetup.com/saskatoon-react-meetup/)
5152
* [Toronto, ON](https://www.meetup.com/Toronto-React-Native/events/)
5253

5354
## Chile {/*chile*/}

src/content/learn/describing-the-ui.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ React — гэта JavaScript бібліятэка для рэндэрынгу
1818
* [Як рэндэрыць кампаненты ў залежнасці ад умоў](/learn/conditional-rendering)
1919
* [Як рэндэрыць некалькі кампанентаў за раз](/learn/rendering-lists)
2020
* [Як пазбягаць памылак, захоўваючы кампанент чыстымі](/learn/keeping-components-pure)
21+
* [Чаму карысна ўяўляць ваш карыстальніцкі інтэрфейс у выглядзе дрэў](/learn/understanding-your-ui-as-a-tree)
2122

2223
</YouWillLearn>
2324

@@ -523,6 +524,28 @@ export default function TeaSet() {
523524

524525
</LearnMore>
525526

527+
## Карыстальніцкі інтэрфейс у выглядзе дрэва {/*your-ui-as-a-tree*/}
528+
529+
React выкарыстоўвае дрэвы для мадэліравання адносін паміж кампанентамі і модулямі.
530+
531+
Дрэва рэндэрынгу React — гэта адлюстраванне бацькоўскіх і даччыных адносін паміж кампанентамі.
532+
533+
<Diagram name="generic_render_tree" height={250} width={500} alt="Дрэвападобны графік з пяццю вузламі, кожны з якіх уяўляе кампанент. Каранёвы вузел знаходзіцца ў верхняй частцы дрэвападобнага графіка і пазначаны як «Каранёвы кампанент (Root Component)». Ён мае дзве стрэлкі, якія ідуць уніз да двух вузлоў, пазначаных «Кампанент A (Component A)» і «Кампанент C (Component C)». Кожная са стрэлак пазначана надпісам «рэндэрыць». «Кампанент A» мае адзіную стрэлку «рэндэрыць» да вузла з надпісам «Кампанент B (Component B)». «Кампанент C» мае адну стрэлку «рэндэрыць» да вузла з надпісам «Кампанент D (Component D)».">Прыклад дрэва рэндэрынгу React.</Diagram>
534+
535+
Кампаненты, якія знаходзяцца ў верхняй частцы дрэва, каля каранёвага кампанента, лічацца кампанентамі верхняга ўзроўню. Кампаненты без даччыных кампанентаў з'яўляюцца ліставымі кампанентамі. Такая класіфікацыя кампанентаў карысная для разумення патоку даных і прадукцыйнасці рэндэрынгу.
536+
537+
Мадэліраванне адносін паміж модулямі JavaScript — гэта яшчэ адзін карысны спосаб зразумець вашу праграму. Мы называем гэта «дрэвам залежнасці модуляў».
538+
539+
<Diagram name="generic_dependency_tree" height={250} width={500} alt="Дрэвападобны графік з пяццю вузламі. Кожны вузел уяўляе сабой JavaScript модуль. Самы верхні вузел пазначаны як «RootModule.js». Ён мае тры стрэлкі, якія ідуць да вузлоў: «ModuleA.js», «ModuleB.js» і «ModuleC.js». Кожная стрэлка пазначана надпісам «імпартуе». Вузел «ModuleC.js» мае адну стрэлку з надпісам «імпартуе», якая паказвае на вузел з надпісам «ModuleD.js».">Прыклад дрэва залежнасцяў модуля.</Diagram>
540+
541+
Дрэва залежнасцяў часта выкарыстоўваецца інструментамі зборкі для аб'яднання ўсяго адпаведнага JavaScript кода для спампоўвання і адлюстравання кліентам. Вялікі памер пакета пагаршае карыстальніцкі досвед узаемадзеяння з праграмамі напісанымі з дапамогай React. Разуменне дрэва залежнасцяў модуля дапамагае вырашаць такія праблемы.
542+
543+
<LearnMore path="/learn/understanding-your-ui-as-a-tree">
544+
545+
Азнаёмцеся са старонкай «**[Карыстальніцкі інтэрфейс у выглядзе дрэва](/learn/understanding-your-ui-as-a-tree)**» каб даведацца як ствараць дрэвы рэндэрынгу і дрэва залежнасцяў модуля для праграмы React і як гэтыя ментальныя мадэлі дапамагаюць палепшыць карыстальніцкі досвед і прадукцыйнасць.
546+
547+
</LearnMore>
548+
526549
## Наступныя крокі {/*whats-next*/}
527550

528551
Пачніце са старонкі «[Ваш першы кампанент](/learn/your-first-component)» каб пачаць чытанне главы старонка за старонкай!

src/content/learn/preserving-and-resetting-state.md

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,17 @@ State is isolated between components. React keeps track of which state belongs t
1010

1111
<YouWillLearn>
1212

13-
* How React "sees" component structures
1413
* When React chooses to preserve or reset the state
1514
* How to force React to reset component's state
1615
* How keys and types affect whether the state is preserved
1716

1817
</YouWillLearn>
1918

20-
## The UI tree {/*the-ui-tree*/}
19+
## State is tied to a position in the render tree {/*state-is-tied-to-a-position-in-the-tree*/}
2120

22-
Browsers use many tree structures to model UI. The [DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model/Introduction) represents HTML elements, the [CSSOM](https://developer.mozilla.org/docs/Web/API/CSS_Object_Model) does the same for CSS. There's even an [Accessibility tree](https://developer.mozilla.org/docs/Glossary/Accessibility_tree)!
23-
24-
React also uses tree structures to manage and model the UI you make. React makes **UI trees** from your JSX. Then React DOM updates the browser DOM elements to match that UI tree. (React Native translates these trees into elements specific to mobile platforms.)
25-
26-
<DiagramGroup>
27-
28-
<Diagram name="preserving_state_dom_tree" height={193} width={864} alt="Diagram with three sections arranged horizontally. In the first section, there are three rectangles stacked vertically, with labels 'Component A', 'Component B', and 'Component C'. Transitioning to the next pane is an arrow with the React logo on top labeled 'React'. The middle section contains a tree of components, with the root labeled 'A' and two children labeled 'B' and 'C'. The next section is again transitioned using an arrow with the React logo on top labeled 'React'. The third and final section is a wireframe of a browser, containing a tree of 8 nodes, which has only a subset highlighted (indicating the subtree from the middle section).">
29-
30-
From components, React creates a UI tree which React DOM uses to render the DOM
31-
32-
</Diagram>
33-
34-
</DiagramGroup>
35-
36-
## State is tied to a position in the tree {/*state-is-tied-to-a-position-in-the-tree*/}
37-
38-
When you give a component state, you might think the state "lives" inside the component. But the state is actually held inside React. React associates each piece of state it's holding with the correct component by where that component sits in the UI tree.
21+
React builds [render trees](learn/understanding-your-ui-as-a-tree#the-render-tree) for the component structure in your UI.
3922

23+
When you give a component state, you might think the state "lives" inside the component. But the state is actually held inside React. React associates each piece of state it's holding with the correct component by where that component sits in the render tree.
4024

4125
Here, there is only one `<Counter />` JSX tag, but it's rendered at two different positions:
4226

@@ -190,7 +174,7 @@ Updating state
190174
</DiagramGroup>
191175

192176

193-
React will keep the state around for as long as you render the same component at the same position. To see this, increment both counters, then remove the second component by unchecking "Render the second counter" checkbox, and then add it back by ticking it again:
177+
React will keep the state around for as long as you render the same component at the same position in the tree. To see this, increment both counters, then remove the second component by unchecking "Render the second counter" checkbox, and then add it back by ticking it again:
194178

195179
<Sandpack>
196180

0 commit comments

Comments
 (0)