diff --git a/content/docs/implementation-notes.md b/content/docs/implementation-notes.md
index b345f7d5d..147ef0b22 100644
--- a/content/docs/implementation-notes.md
+++ b/content/docs/implementation-notes.md
@@ -1,6 +1,6 @@
---
id: implementation-notes
-title: Implementation Notes
+title: Tətbiq Qeydləri
layout: contributing
permalink: docs/implementation-notes.html
prev: codebase-overview.html
@@ -9,93 +9,93 @@ redirect_from:
- "contributing/implementation-notes.html"
---
-This section is a collection of implementation notes for the [stack reconciler](/docs/codebase-overview.html#stack-reconciler).
+Bu bölmə, [stack rekonsilyatoru](/docs/codebase-overview.html#stack-reconciler) haqqında tətbiq qeydlərinin yığımıdır.
-It is very technical and assumes a strong understanding of React public API as well as how it's divided into core, renderers, and the reconciler. If you're not very familiar with the React codebase, read [the codebase overview](/docs/codebase-overview.html) first.
+Bu səhifə çox texnikidir və React-in açıq API-ı və React-in necə core, render edici qurğular və rekonsilyatora ayrıldığı haqqında anlayışınızın olduğunu ehtimal edir. Əgər React kodu ilə tanışlığınız yoxdursa, ilk öncə [Kodun İcmalı](/docs/codebase-overview.html) bölməsini oxuyun.
-It also assumes an understanding of the [differences between React components, their instances, and elements](/blog/2015/12/18/react-components-elements-and-instances.html).
+Bu səhifədə [React komponentləri, instansiyaları və elementləri](/blog/2015/12/18/react-components-elements-and-instances.html) arasında olan fərqlərdən xəbərinizin olduğu ehtimal edilir.
-The stack reconciler was used in React 15 and earlier. It is located at [src/renderers/shared/stack/reconciler](https://github.com/facebook/react/tree/15-stable/src/renderers/shared/stack/reconciler).
+Stack rekonsilyatoru React 15 və əvvəli buraxılışlarında işlədilirdi. Bu rekonsilyatorun kodu [src/renderers/shared/stack/reconciler](https://github.com/facebook/react/tree/15-stable/src/renderers/shared/stack/reconciler) direktoriyasında saxlanılır.
-### Video: Building React from Scratch {#video-building-react-from-scratch}
+### Video: React-in Sıfırdan Yazılması {#video-building-react-from-scratch}
-[Paul O'Shannessy](https://twitter.com/zpao) gave a talk about [building React from scratch](https://www.youtube.com/watch?v=_MAD4Oly9yg) that largely inspired this document.
+[Paul O'Şannesinin](https://twitter.com/zpao) [React-in sıfırdan yazılması haqqında danışığı](https://www.youtube.com/watch?v=_MAD4Oly9yg) bizim bu sənədi yazmamıza ilham verdi.
-Both this document and his talk are simplifications of the real codebase so you might get a better understanding by getting familiar with both of them.
+Bu sənəddə və göstərilən danışıqda olan detallar real kodun sadələşmiş formasıdır. Bunun səbəbi sizin bu konsepsiyaları daha yaxşı başa düşməniz üçündür.
-### Overview {#overview}
+### İcmal {#overview}
-The reconciler itself doesn't have a public API. [Renderers](/docs/codebase-overview.html#renderers) like React DOM and React Native use it to efficiently update the user interface according to the React components written by the user.
+Rekonsilyatorun açıq API-ı yoxdur. React DOM və React Native kimi [Render edici qurğular](/docs/codebase-overview.html#renderers) rekonsilyatordan istifadə edərək proqramçılar tərəfindən yazılan React komponentləri əsasında istifadəçi intereysini effektiv şəkildə yeniləyirlər.
-### Mounting as a Recursive Process {#mounting-as-a-recursive-process}
+### Rekursiv Proses şəklində Mount Edilmə {#mounting-as-a-recursive-process}
-Let's consider the first time you mount a component:
+Gəlin komponentin ilk dəfə mount edilməsinə baxaq:
```js
ReactDOM.render(, rootEl);
```
-React DOM will pass `` along to the reconciler. Remember that `` is a React element, that is, a description of *what* to render. You can think about it as a plain object:
+React DOM, `` elementini rekonsilyatora göndərir. ``-in React elementi (yəni, *nəyin* render ediləcəyinin təsviri) olduğunu yaddan çıxarmayın. Siz, bunun sadə obyekt olduğunu fikirləşə bilərsiniz:
```js
console.log();
// { type: App, props: {} }
```
-The reconciler will check if `App` is a class or a function.
+Rekonsilyator `App`-in sinif və ya funksiya olduğunu yoxlayır.
-If `App` is a function, the reconciler will call `App(props)` to get the rendered element.
+Əgər `App` funksiyadırsa, render olunan elementi almaq üçün rekonsilyator `App(props)` funksiyasını çağıracaq.
-If `App` is a class, the reconciler will instantiate an `App` with `new App(props)`, call the `componentWillMount()` lifecycle method, and then will call the `render()` method to get the rendered element.
+Əgər `App` sinifdirsə, rekonsilyator `App` obyektini `new App(props)` işlədərək yaradacaq, obyektin `componentWillMount()` lifecycle funksiyasını çağıracaq, və render olunan elementi almaq üçün obyektin `render()` funksiyasını çağıracaq.
-Either way, the reconciler will learn the element `App` "rendered to".
+Hər iki halda rekonsilyator `App`-in "render etdiyi" elementi tapacaq.
-This process is recursive. `App` may render to a ``, `Greeting` may render to a ``, and so on. The reconciler will "drill down" through user-defined components recursively as it learns what each component renders to.
+Bu proses rekursivdir. `App` ``-i render edə bilər, `Greeting` ``-u render edə bilər, və s. Rekonsilyator hər komponentin nəyi render etdiyini öyrənmək üçün istifadəçi tərəfindən yaradılan komponenləri bir-bir yoxlayır.
-You can imagine this process as a pseudocode:
+Siz bu prosesi aşağıdakı pseudokod kimi görə bilərsiniz:
```js
function isClass(type) {
- // React.Component subclasses have this flag
+ // React.Component alt siniflərində bu flaq var
return (
Boolean(type.prototype) &&
Boolean(type.prototype.isReactComponent)
);
}
-// This function takes a React element (e.g. )
-// and returns a DOM or Native node representing the mounted tree.
+// Bu funksiya React elementi qəbul edir (yəni, )
+// və mount olunan ağacı təmsil edən DOM və ya Native nodu qaytarır.
function mount(element) {
var type = element.type;
var props = element.props;
- // We will determine the rendered element
- // by either running the type as function
- // or creating an instance and calling render().
+ // Biz, type dəyişənini funksiya kimi çağıraraq və ya
+ // instansiya yaradıb obyektin render() funksiyasını çağıraraq
+ // render olunan elementi müəyyənləşdiririk.
var renderedElement;
if (isClass(type)) {
- // Component class
+ // Komponent sinfi
var publicInstance = new type(props);
- // Set the props
+ // Propları təyin et
publicInstance.props = props;
- // Call the lifecycle if necessary
+ // Lazım olduqda lifecycle funksiyalarını çağır
if (publicInstance.componentWillMount) {
publicInstance.componentWillMount();
}
- // Get the rendered element by calling render()
+ // render()-i çağıraraq render olunan elementi müəyyənləşdir
renderedElement = publicInstance.render();
} else {
- // Component function
+ // Komponent funksiyası
renderedElement = type(props);
}
- // This process is recursive because a component may
- // return an element with a type of another component.
+ // Komponentin qaytardığı elementin digər komponent ola bildiyindən
+ // bu funksiya rekursiv olmalıdır
return mount(renderedElement);
- // Note: this implementation is incomplete and recurses infinitely!
- // It only handles elements like or .
- // It doesn't handle elements like
or yet.
+ // Qeyd: Bu tətbiq tam deyil və sonsuza qədər rekursiya edəcək!
+ // Bu funksiya yalnız və ya kimi elementlər ilə işləyir.
+ // Bu funksiya və ya kimi elementlər ilə işləmir.
}
var rootEl = document.getElementById('root');
@@ -103,81 +103,81 @@ var node = mount();
rootEl.appendChild(node);
```
->**Note:**
+>**Qeyd:**
>
->This really *is* a pseudo-code. It isn't similar to the real implementation. It will also cause a stack overflow because we haven't discussed when to stop the recursion.
+>Bu *yalnız* pseudokoddur. Bu, real tətbiqə bənzəmir. Əlavə olaraq, biz rekursiyanı dayandırmamışıq deyə burada stək daşacaq.
-Let's recap a few key ideas in the example above:
+Gəlin, yuxarıdakı nümunədə olan ideaları təkrarlayaq:
-* React elements are plain objects representing the component type (e.g. `App`) and the props.
-* User-defined components (e.g. `App`) can be classes or functions but they all "render to" elements.
-* "Mounting" is a recursive process that creates a DOM or Native tree given the top-level React element (e.g. ``).
+* React elementləri komponent tipini (məsələn, `App`) və proplarını təmsil edən sadə obyektlərdir.
+* İstifadəçi tərəfindən düzələn komponentlər (məsələn, `App`) həm sinif həm də funksiya ola bilər və digər elementlərə də "render edilə" bilərlər.
+* "Mount Edilmə" əməliyyatı yuxarı səviyyədə olan React elementi (məsələn, ``) əsasında DOM və ya Nativ ağacı yaradan rekursiv prosesdir.
-### Mounting Host Elements {#mounting-host-elements}
+### Sahib Elementlərin Mount Edilməsi {#mounting-host-elements}
-This process would be useless if we didn't render something to the screen as a result.
+Əgər mount edilmə zamanı ekranda heç nə göstərilmirsə, bu proses faydasız olardı.
-In addition to user-defined ("composite") components, React elements may also represent platform-specific ("host") components. For example, `Button` might return a `` from its render method.
+React elementləri istifadəçi tərəfindən yaradılan ("kompozit") komponentlərdən əlavə platformaya spesifik ("sahib" və ya "host") komponentləri də təmsil edə bilər. Məsələn, `Button` komponenti render zamanı `` elementini qaytara bilər.
-If element's `type` property is a string, we are dealing with a host element:
+Sahib elementlərin `type` parametri mətn şəklində olur:
```js
console.log();
// { type: 'div', props: {} }
```
-There is no user-defined code associated with host elements.
+Sahib elementlərin istifadəçi kodu olmur.
-When the reconciler encounters a host element, it lets the renderer take care of mounting it. For example, React DOM would create a DOM node.
+Rekonsilyator sahib element ilə qarşılaşdıqda elementin mount edilməsi üçün render edici qurğuya göndərir. Məsələn, React DOM brauzerdə DOM nodunu yaradır.
-If the host element has children, the reconciler recursively mounts them following the same algorithm as above. It doesn't matter whether children are host (like `
`), composite (like ``), or both.
+Sahib elementin uşaqları olduqda rekonsilyator yuxarıdakı alqoritm ilə elementləri rekursiv şəkildə mount edir. Burada uşaqların sahib (`
` kimi), kompozit (`` kimi) və ya hər ikisi olmasının fərqi yoxdur.
-The DOM nodes produced by the child components will be appended to the parent DOM node, and recursively, the complete DOM structure will be assembled.
+Uşaq komponentlərdə istehsal olunan DOM nodları ana DOM noduna əlavə olunacaq və bütün DOM strukturu rekursiv şəkildə yığılacaq.
->**Note:**
+>**Qeyd:**
>
->The reconciler itself is not tied to the DOM. The exact result of mounting (sometimes called "mount image" in the source code) depends on the renderer, and can be a DOM node (React DOM), a string (React DOM Server), or a number representing a native view (React Native).
+>Rekonsilyator DOM-dan azaddır. Mount olunan nəticə (bəzən kodda "mount image" adlanır) render edici qurğudan asılıdır. Bu nəticə DOM nodu (React DOM), mətn (React DOM Server) və nativ görünüşü təmsil edən rəqəm (React Native) ola bilər.
-If we were to extend the code to handle host elements, it would look like this:
+Biz yuxarıdakı koda sahib elementləri əlavə etdikdə bizim kodumuz aşağıdakı formada olacaq:
```js
function isClass(type) {
- // React.Component subclasses have this flag
+ // React.Component alt siniflərində bu flaq var
return (
Boolean(type.prototype) &&
Boolean(type.prototype.isReactComponent)
);
}
-// This function only handles elements with a composite type.
-// For example, it handles and , but not a .
+// Bu funksiya yalnız kompozit tipli elementlər ilə işləyir.
+// Yəni, bu funksiya və elementləri ilə işləyir, ilə işləmir.
function mountComposite(element) {
var type = element.type;
var props = element.props;
var renderedElement;
if (isClass(type)) {
- // Component class
+ // Komponent sinfi
var publicInstance = new type(props);
- // Set the props
+ // Propları təyin et
publicInstance.props = props;
- // Call the lifecycle if necessary
+ // Lazım olduqda lifecycle funksiyalarını çağır
if (publicInstance.componentWillMount) {
publicInstance.componentWillMount();
}
renderedElement = publicInstance.render();
} else if (typeof type === 'function') {
- // Component function
+ // Komponent funksiyası
renderedElement = type(props);
}
- // This is recursive but we'll eventually reach the bottom of recursion when
- // the element is host (e.g. ) rather than composite (e.g. ):
+ // Bu funksiya rekursivdir lakin biz sahib elementinə (məsələn, ) çatdıqda
+ // rekursiya dayanacaq:
return mount(renderedElement);
}
-// This function only handles elements with a host type.
-// For example, it handles and but not an .
+// Bu funksiya yalnız sahib elementlər üçündür.
+// Yəni, bu funksiya və kimi elementlər ilə işləyir, ilə yox.
function mountHost(element) {
var type = element.type;
var props = element.props;
@@ -187,9 +187,9 @@ function mountHost(element) {
}
children = children.filter(Boolean);
- // This block of code shouldn't be in the reconciler.
- // Different renderers might initialize nodes differently.
- // For example, React Native would create iOS or Android views.
+ // Bu kod bloku rekonsilyatorda olmamalıdır.
+ // Fərqli render edici qurğularda nodlar fərqli formada inisializasiya olunur.
+ // Məsələn, React Native qurğusu iOS və Android görünüşləri yaradır.
var node = document.createElement(type);
Object.keys(props).forEach(propName => {
if (propName !== 'children') {
@@ -197,29 +197,29 @@ function mountHost(element) {
}
});
- // Mount the children
+ // Uşaqları mount et
children.forEach(childElement => {
- // Children may be host (e.g. ) or composite (e.g. ).
- // We will also mount them recursively:
+ // Uşaqlar həm sahib (məsələn, ) həm də kompozit (məsələn, ) ola bilərlər.
+ // Biz həmçinin bu elementləri rekursiv şəkildə mount edə bilərik:
var childNode = mount(childElement);
- // This line of code is also renderer-specific.
- // It would be different depending on the renderer:
+ // Bu kod da render edici qurğuya aiddir.
+ // Qurğudan asılı olaraq dəyişir:
node.appendChild(childNode);
});
- // Return the DOM node as mount result.
- // This is where the recursion ends.
+ // Mount nəticəsi kimi DOM nodunu qaytar.
+ // Rekursiya burada bitir.
return node;
}
function mount(element) {
var type = element.type;
if (typeof type === 'function') {
- // User-defined components
+ // İstifadəçi tərəfindən yazılan komponentlər
return mountComposite(element);
} else if (typeof type === 'string') {
- // Platform-specific components
+ // Platformaya xas komponentlər
return mountHost(element);
}
}
@@ -229,40 +229,40 @@ var node = mount();
rootEl.appendChild(node);
```
-This is working but still far from how the reconciler is really implemented. The key missing ingredient is support for updates.
+Bunun işlək olmasına baxmayaraq bu tətbiq rekonsilyatorun əsl tətbiqindən çox fərqlənir. Burada yeniliklər hələki dəstəklənmir.
-### Introducing Internal Instances {#introducing-internal-instances}
+### Daxili İnstansiyalar ilə Tanışlıq {#introducing-internal-instances}
-The key feature of React is that you can re-render everything, and it won't recreate the DOM or reset the state:
+React-in əsas xüsusiyyətlərindən biri bütün elementlərin yenidən render olunduğundan baxmayaraq DOM-un yenidən yaradılmaması və state-in sıfırlanmamasıdır:
```js
ReactDOM.render(, rootEl);
-// Should reuse the existing DOM:
+// Eyni DOM nodlarını işlədəcək:
ReactDOM.render(, rootEl);
```
-However, our implementation above only knows how to mount the initial tree. It can't perform updates on it because it doesn't store all the necessary information, such as all the `publicInstance`s, or which DOM `node`s correspond to which components.
+Lakin, bizim tətbiqimiz yalnız ilkin ağacı mount etməyi bilir. Bizim tətbiqimizin `publicInstance`-lar və ya DOM `node`-ların hansı komponentlərə uyğun olduğu kimi lazımi məlumatlardan xəbəri olmadığından biz bu ağacın üstündə yeniliklər edə bilmirik.
-The stack reconciler codebase solves this by making the `mount()` function a method and putting it on a class. There are drawbacks to this approach, and we are going in the opposite direction in the [ongoing rewrite of the reconciler](/docs/codebase-overview.html#fiber-reconciler). Nevertheless this is how it works now.
+Stack rekonsilyatoru `mount` funksiyasını sinif metodu edərək bu problemi həll edir. Bu yanaşmanın çatışmazlıqları olduğundan biz [proqresdə olan rekonsilyatorun yenidən yazılmasında](/docs/codebase-overview.html#fiber-reconciler) bu həllə əks istiqamətdə gedirik. Buna baxmayaraq indiki zamanda rekonsilyator belə işləyir.
-Instead of separate `mountHost` and `mountComposite` functions, we will create two classes: `DOMComponent` and `CompositeComponent`.
+Biz, fərqli `mountHost` və `mountComposite` funksiyaları əvəzinə iki sinif yaradacağıq: `DOMComponent` və `CompositeComponent`.
-Both classes have a constructor accepting the `element`, as well as a `mount()` method returning the mounted node. We will replace a top-level `mount()` function with a factory that instantiates the correct class:
+Hər iki sinfin `element` qəbul edən konstruktoru və mount olunan nodu qaytaran `mount()` funksiyası var. Biz, yuxarı səviyyəli `mount()` funksiyasını düzgün sinif instansiyası qaytaran zavod ilə əvəzləyəcəyik:
```js
function instantiateComponent(element) {
var type = element.type;
if (typeof type === 'function') {
- // User-defined components
+ // İstifadəçi tərəfindən təyin edilən komponentlər
return new CompositeComponent(element);
} else if (typeof type === 'string') {
- // Platform-specific components
+ // Platformaya xas olan komponentlər
return new DOMComponent(element);
}
}
```
-First, let's consider the implementation of `CompositeComponent`:
+İlk olaraq gəlin `CompositeComponent` sinfinin tətbiqinə baxaq:
```js
class CompositeComponent {
@@ -273,7 +273,7 @@ class CompositeComponent {
}
getPublicInstance() {
- // For composite components, expose the class instance.
+ // Kompozit komponentlərdə sinif instansiyasını ifşa et.
return this.publicInstance;
}
@@ -285,45 +285,45 @@ class CompositeComponent {
var publicInstance;
var renderedElement;
if (isClass(type)) {
- // Component class
+ // Komponent sinfi
publicInstance = new type(props);
- // Set the props
+ // Propları təyin edin
publicInstance.props = props;
- // Call the lifecycle if necessary
+ // Lazım olan lifecycle metodlarını çağır
if (publicInstance.componentWillMount) {
publicInstance.componentWillMount();
}
renderedElement = publicInstance.render();
} else if (typeof type === 'function') {
- // Component function
+ // Komponent funksiyası
publicInstance = null;
renderedElement = type(props);
}
- // Save the public instance
+ // Açıq instansiyanı təyin et
this.publicInstance = publicInstance;
- // Instantiate the child internal instance according to the element.
- // It would be a DOMComponent for or ,
- // and a CompositeComponent for or :
+ // Element əsasında uşağın daxili instansiyasını yarat
+ // və ya kimi elementlər üçün DOMComponent,
+ // və ya kimi elementlər üçün isə CompositeComponent olacaq:
var renderedComponent = instantiateComponent(renderedElement);
this.renderedComponent = renderedComponent;
- // Mount the rendered output
+ // Render nəticəsini mount et
return renderedComponent.mount();
}
}
```
-This is not much different from our previous `mountComposite()` implementation, but now we can save some information, such as `this.currentElement`, `this.renderedComponent`, and `this.publicInstance`, for use during updates.
+Bu, əvvəlki `mountComposite()` tətbiqindən çox da fərqli deyil, amma indi yeniliklər üçün sinifdə `this.currentElement`, `this.renderedComponent` və `this.publicInstance` kimi dəyişənlər saxlanılır.
-Note that an instance of `CompositeComponent` is not the same thing as an instance of the user-supplied `element.type`. `CompositeComponent` is an implementation detail of our reconciler, and is never exposed to the user. The user-defined class is the one we read from `element.type`, and `CompositeComponent` creates an instance of it.
+Nəzərə alın ki, `CompositeComponent`-in instansiyası istifadəçi tərəfindən verilən `element.type`-ın instansiyası ilə eyni deyil. `CompositeComponent` sinfi rekonsilyatorun tətbiq detalıdır və istifadəçi bunu heç vaxt görmür. İstifadəçi tərəfindən təyin edilən sinif `element.type`-dan oxunulur, `CompositeComponent` isə bu oxunan element üçün instansiya yaradır.
-To avoid the confusion, we will call instances of `CompositeComponent` and `DOMComponent` "internal instances". They exist so we can associate some long-lived data with them. Only the renderer and the reconciler are aware that they exist.
+Çaşqınlıqdan qaçınmaq üçün biz `CompositeComponent` və `DOMComponent` siniflərinin instansiyalarını "daxili instansiyalar" adlandıracağıq. Bu instansiyaların mövcud olmasının səbəbi sinfin daxilində məlumatlar saxlaya bilməyimiz üçün lazımdır. Bu instansiyalardan yalnız render edici qurğuların və rekonsilyatorun xəbəri var.
-In contrast, we call an instance of the user-defined class a "public instance". The public instance is what you see as `this` in the `render()` and other methods of your custom components.
+Biz, istifadəçi tərəfindən təyin olunan siniflərin instansiyalarını "açıq instansiyalar" adlandırırıq. Açıq instansiyaya xüsusi komponentin `render()` funksiyasında gördüyünüz `this` dəyəri aiddir.
-The `mountHost()` function, refactored to be a `mount()` method on `DOMComponent` class, also looks familiar:
+`DOMComponent` sinfinin `mount()` funksiyası ilə əvəzlənən `mountHost()` funksiyası aşağıdakı kimidir:
```js
class DOMComponent {
@@ -334,7 +334,7 @@ class DOMComponent {
}
getPublicInstance() {
- // For DOM components, only expose the DOM node.
+ // DOM komponentlərində yalnız DOM nodunu ifşa et.
return this.node;
}
@@ -347,36 +347,36 @@ class DOMComponent {
children = [children];
}
- // Create and save the node
+ // DOM-u yaradıb saxla
var node = document.createElement(type);
this.node = node;
- // Set the attributes
+ // Atributları təyin et
Object.keys(props).forEach(propName => {
if (propName !== 'children') {
node.setAttribute(propName, props[propName]);
}
});
- // Create and save the contained children.
- // Each of them can be a DOMComponent or a CompositeComponent,
- // depending on whether the element type is a string or a function.
+ // Uşaqları yaradıb saxlayın.
+ // Hər bir uşaq element tipinin mətn və ya funksiya olması əsasında
+ // DOMComponent ya da CompositeComponent ola bilər.
var renderedChildren = children.map(instantiateComponent);
this.renderedChildren = renderedChildren;
- // Collect DOM nodes they return on mount
+ // Mount olunan zaman qaytarılan DOM nodlarını yığın
var childNodes = renderedChildren.map(child => child.mount());
childNodes.forEach(childNode => node.appendChild(childNode));
- // Return the DOM node as mount result
+ // Mount nəticəsində qaytarılan DOM nodu
return node;
}
}
```
-The main difference after refactoring from `mountHost()` is that we now keep `this.node` and `this.renderedChildren` associated with the internal DOM component instance. We will also use them for applying non-destructive updates in the future.
+`mountHost()`-u refaktorinq etdikdən sonra əsas dəyişiklik daxili DOM komponentinin insansiyasında `this.node` və `this.renderedChildren` dəyişənlərinin saxlanmasıdır. Biz bu dəyişənlərdən istifadə edərək gələcəkdə dağılmayan yenilikləri tətbiq edə biləcəyik.
-As a result, each internal instance, composite or host, now points to its child internal instances. To help visualize this, if a function `` component renders a `