-
Notifications
You must be signed in to change notification settings - Fork 17
Composition vs Inheritance page #96
base: main
Are you sure you want to change the base?
Conversation
Deploy preview for ro-reactjs ready! Built with commit 2e7868f |
@Mavroian requested some changes |
1 similar comment
@Mavroian requested some changes |
@RaulTsc I am sorry, I don’t see any notes on the changes that you wanted me to make, can you please specify the areas that need changes. Thank you |
@@ -1,22 +1,22 @@ | |||
--- | |||
id: composition-vs-inheritance | |||
title: Composition vs Inheritance | |||
titlu: Composition vs Inheritance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding of markdown files attributes like: title, prev, next should be left unchanged (so no translation to titlu, anterior, urmator) because ReactJS is made with Gatsby which uses those attributes to set the title of the page and link to prev/next articles. So you should translate only Composition vs Inheritance.
permalink: docs/composition-vs-inheritance.html | ||
redirect_from: | ||
- "docs/multiple-components.html" | ||
prev: lifting-state-up.html | ||
next: thinking-in-react.html | ||
anterior: lifting-state-up.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above comment.
prev: lifting-state-up.html | ||
next: thinking-in-react.html | ||
anterior: lifting-state-up.html | ||
urmator: thinking-in-react.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above comment.
|
||
Some components don't know their children ahead of time. This is especially common for components like `Sidebar` or `Dialog` that represent generic "boxes". | ||
Unele componente nu își cunosc copiii înainte de timp. Acest lucru este valabil mai ales pentru componente precum `Sidebar` sau` Dialog` care reprezintă casete generice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use, instead of 'inainte de timp', 'dinainte' or 'in avans'.
|
||
In this section, we will consider a few problems where developers new to React often reach for inheritance, and show how we can solve them with composition. | ||
În această secțiune, vom analiza câteva probleme în care dezvoltatorii novici în React aleg adesea moștenirea și vom arata cum le putem rezolva prin compoziție. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use 'va vom arata'.
|
||
We recommend that such components use the special `children` prop to pass children elements directly into their output: | ||
Recomandăm ca astfel de componente să utilizeze proprietățile specifice pentru `copii` astfel încât sa transmita elementele de copii direct în producția lor: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This phrase refers to the 'children' props, in translation meaning: proprietatea speciala children
@@ -28,7 +28,8 @@ function FancyBorder(props) { | |||
} | |||
``` | |||
|
|||
This lets other components pass arbitrary children to them by nesting the JSX: | |||
Acest lucru permite altor componente să introducă in ele copii la întâmplare prin cuibărind JSX-ul: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of 'cuibarind' I would use a longer translation. Something like: 'prin adaugarea codului JSX intre tag-urile componentei'.
**[Try it on CodePen](https://codepen.io/gaearon/pen/ozqNOV?editors=0010)** | ||
**[Incercați in CodePen](https://codepen.io/gaearon/pen/ozqNOV?editors=0010)** | ||
|
||
Orice element din interiorul tag-ul JSX `<FancyBorder>`devine trecut în componența` FancyBorder` ca si proprietăți de `copii` Din moment ce `FancyBorder` redă` {props.children} `in interiorul unui <div> `, elementele apar în rezultatul final. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the text in quotations to be exactly as the original including spaces. If it's in quotes - `` - don't translate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like children for instance.
|
||
React elements like `<Contacts />` and `<Chat />` are just objects, so you can pass them as props like any other data. This approach may remind you of "slots" in other libraries but there are no limitations on what you can pass as props in React. | ||
Elementele React precum `<Contacts />` și `<Chat />` sunt doar obiecte, astfel le poți trece ca si proprietati, ca orice alte date. Această abordare vă poate aminti de "slots" din alte librari, dar nu există nicio limitare a ceea ce puteți trece ca elemente de recuzită în React. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not translate props here as elemente de recuzita. I would leave it like props.
|
||
Sometimes we think about components as being "special cases" of other components. For example, we might say that a `WelcomeDialog` is a special case of `Dialog`. | ||
## Specialization {#specialization} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be translated.
|
||
Sometimes we think about components as being "special cases" of other components. For example, we might say that a `WelcomeDialog` is a special case of `Dialog`. | ||
## Specialization {#specialization} | ||
Cateodată ne gândim la componente ca find "cazuri speciale" a altor comnponente. De exemplu am putea spunde ca un `WelcomeDialog` e un cas special a `Dialog`-ului. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo => cas to caz
|
||
In React, this is also achieved by composition, where a more "specific" component renders a more "generic" one and configures it with props: | ||
In React, acest lucru este deasemenea arhivat de către compoziție,unde o componenta mai "specifica" reda una mai "generica" si o configureaza cu proprietati: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'arhivat' is not the word you are looking for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a few comments. There are also some punctuation you missed - using s instead of ș or a instead of ă. Also check spacing after period.
For having a good quality of your code I suggest testing it locally first. You would have fixed a lot of problems this way.
Also I think that, in general, people are discouraged to review you code when it has a lot of mistakes. Not sure if it's the case here. Still, good job. Waiting for the chnages :)
Thank you Alexandru, I will make the changes you suggested and test it locally. |
Translated Composition vs Inheritance #19
#1