` sintaksu](/reference/react/Fragment#rendering-a-list-of-fragments):
```js
import { Fragment } from 'react';
@@ -395,46 +407,46 @@ const listItems = people.map(person =>
);
```
-Fragments disappear from the DOM, so this will produce a flat list of ``, `
`, `
`, `
`, and so on.
+Fragment-i nestaju iz DOM-a, tako da ćete dobiti listu od `
`, `
`, `
`, `
`, i tako dalje.
-### Where to get your `key` {/*where-to-get-your-key*/}
+### Gde dobiti `key` {/*where-to-get-your-key*/}
-Different sources of data provide different sources of keys:
+Različiti izvori podataka pružaju različite ključeve:
-* **Data from a database:** If your data is coming from a database, you can use the database keys/IDs, which are unique by nature.
-* **Locally generated data:** If your data is generated and persisted locally (e.g. notes in a note-taking app), use an incrementing counter, [`crypto.randomUUID()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID) or a package like [`uuid`](https://www.npmjs.com/package/uuid) when creating items.
+* **Podaci iz baze podataka:** Ako podaci dolaze iz baze podataka, možete koristiti ključeve ili ID-eve iz baze podataka, koji su po prirodi jedinstveni.
+* **Lokalno generisani podaci:** Ako su vam podaci generisani i čuvani lokalno (npr. beleške u aplikaciji za zabeleške), koristite inkrementalni brojač, [`crypto.randomUUID()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID) ili pakete poput [`uuid`](https://www.npmjs.com/package/uuid) kada kreirate stavke.
-### Rules of keys {/*rules-of-keys*/}
+### Pravila ključeva {/*rules-of-keys*/}
-* **Keys must be unique among siblings.** However, it’s okay to use the same keys for JSX nodes in _different_ arrays.
-* **Keys must not change** or that defeats their purpose! Don't generate them while rendering.
+* **Ključevi moraju biti jedinstveni između „sestrinskih” stavki.** Međutim, u redu je koristiti iste ključeve za JSX čvorove u _različitim_ nizovima.
+* **Ključevi se ne smeju menjati** ili će im se svrha obesmisliti! Nemojte ih generisati tokom renderovanja.
-### Why does React need keys? {/*why-does-react-need-keys*/}
+### Zašto su React-u potrebni ključevi? {/*why-does-react-need-keys*/}
-Imagine that files on your desktop didn't have names. Instead, you'd refer to them by their order -- the first file, the second file, and so on. You could get used to it, but once you delete a file, it would get confusing. The second file would become the first file, the third file would be the second file, and so on.
+Zamislite da fajlovi na vašem desktop-u nemaju imena. Umesto toga, referencirali bi ih po njihovom redosledu -- prvi fajl, drugi fajl, i tako dalje. Mogli biste se navići, ali jednom kada obrišete fajl, postalo bi zbunjujuće. Drugi fajl bi postao prvi fajl, treći fajl bi postao drugi fajl, i tako dalje.
-File names in a folder and JSX keys in an array serve a similar purpose. They let us uniquely identify an item between its siblings. A well-chosen key provides more information than the position within the array. Even if the _position_ changes due to reordering, the `key` lets React identify the item throughout its lifetime.
+Imena fajlova u folderu i JSX ključevi imaju sličnu ulogu. Omogućavaju nam da jedinstveno identifikujemo stavku među „sestrinskim” stavkama. Dobro odabran ključ pruža više informacija od puke pozicije u nizu. Čak iako se _pozicija_ promeni zbog promene redosleda, `key` omogućava React-u da identifikuje stavku tokom njenog životnog veka.
-You might be tempted to use an item's index in the array as its key. In fact, that's what React will use if you don't specify a `key` at all. But the order in which you render items will change over time if an item is inserted, deleted, or if the array gets reordered. Index as a key often leads to subtle and confusing bugs.
+Možete biti u iskušenju da koristite indeks člana niza kao njegov ključ. U suštini, to je ono što će React koristiti ako ne specificirate `key`. Ali, redosled u kojem renderujete stavke će se menjati tokom vremena ako se neka stavka ubaci, obriše, ili se promeni redosled niza. Indeks kao ključ često dovodi do suptilnih i zbunjujućih bug-ova.
-Similarly, do not generate keys on the fly, e.g. with `key={Math.random()}`. This will cause keys to never match up between renders, leading to all your components and DOM being recreated every time. Not only is this slow, but it will also lose any user input inside the list items. Instead, use a stable ID based on the data.
+Slično tome, nemojte generisati ključeve u hodu, npr. pomoću `key={Math.random()}`. Ovo će učiniti da se ključevi ne podudaraju između renderovanja, što znači da će sve vaše komponente, kao i DOM, biti ponovo kreirane svaki put. Ne samo što je sporo, već ćete izgubiti bilo koji korisnički input unutar stavke liste. Umesto toga, koristite stabilan ID baziran na podacima.
-Note that your components won't receive `key` as a prop. It's only used as a hint by React itself. If your component needs an ID, you have to pass it as a separate prop: ``.
+Obratite pažnju da vaše komponente neće primiti `key` kao prop. Njega sam React koristi kao nagoveštaj. Ako je vašoj komponenti potreban ID, morate ga proslediti kao poseban prop: ``.
-On this page you learned:
+Na ovoj stranici naučili ste:
-* How to move data out of components and into data structures like arrays and objects.
-* How to generate sets of similar components with JavaScript's `map()`.
-* How to create arrays of filtered items with JavaScript's `filter()`.
-* Why and how to set `key` on each component in a collection so React can keep track of each of them even if their position or data changes.
+* Kako da premestite podatke iz komponenti u strukture podataka poput nizova i objekata.
+* Kako da generišete setove sličnih komponenata pomoću JavaScript-ovog `map()`-a.
+* Kako da kreirate nizove filtriranih stavki pomoću JavaScript-ovog `filter()`-a.
+* Zašto i kako da postavite `key` za svaku komponentu u kolekciji, kako bi React mogao da prati svaku od njih, čak iako im se pozicija ili podaci promene.
@@ -442,11 +454,11 @@ On this page you learned:
-#### Splitting a list in two {/*splitting-a-list-in-two*/}
+#### Podeliti listu na dva dela {/*splitting-a-list-in-two*/}
-This example shows a list of all people.
+Ovaj primer prikazuje listu svih ljudi.
-Change it to show two separate lists one after another: **Chemists** and **Everyone Else.** Like previously, you can determine whether a person is a chemist by checking if `person.profession === 'chemist'`.
+Promenite ga da prikazuje dve odvojene liste jednu za drugom: **Hemičari** i **Svi ostali**. Kao i ranije, možete odrediti da li je osoba hemičar sledećim uslovom `person.profession === 'hemičar'`.
@@ -464,13 +476,13 @@ export default function List() {
{person.name}:
{' ' + person.profession + ' '}
- known for {person.accomplishment}
+ poznat je zbog {person.accomplishment}
);
return (
- Scientists
+ Naučnici
);
@@ -481,32 +493,32 @@ export default function List() {
export const people = [{
id: 0,
name: 'Creola Katherine Johnson',
- profession: 'mathematician',
- accomplishment: 'spaceflight calculations',
+ profession: 'matematičar',
+ accomplishment: 'formula za svemirske letove',
imageId: 'MK3eW3A'
}, {
id: 1,
name: 'Mario José Molina-Pasquel Henríquez',
- profession: 'chemist',
- accomplishment: 'discovery of Arctic ozone hole',
+ profession: 'hemičar',
+ accomplishment: 'otkriće Arktičke rupe u ozonu',
imageId: 'mynHUSa'
}, {
id: 2,
name: 'Mohammad Abdus Salam',
- profession: 'physicist',
- accomplishment: 'electromagnetism theory',
+ profession: 'fizičar',
+ accomplishment: 'teorija o elektromagnetizmu',
imageId: 'bE7W1ji'
}, {
id: 3,
name: 'Percy Lavon Julian',
- profession: 'chemist',
- accomplishment: 'pioneering cortisone drugs, steroids and birth control pills',
+ profession: 'hemičar',
+ accomplishment: 'pionirski kortizon, steroidi i pilule za kontrolu rađanja',
imageId: 'IOjWm71'
}, {
id: 4,
name: 'Subrahmanyan Chandrasekhar',
- profession: 'astrophysicist',
- accomplishment: 'white dwarf star mass calculations',
+ profession: 'astrofizičar',
+ accomplishment: 'računanje mase belog patuljka',
imageId: 'lrWQx8l'
}];
```
@@ -537,7 +549,7 @@ img { width: 100px; height: 100px; border-radius: 50%; }
-You could use `filter()` twice, creating two separate arrays, and then `map` over both of them:
+Možete koristiti `filter()` dvaput, kreirajući dva odvojena niza, a nakon toga pozvati `map` nad oba:
@@ -547,15 +559,15 @@ import { getImageUrl } from './utils.js';
export default function List() {
const chemists = people.filter(person =>
- person.profession === 'chemist'
+ person.profession === 'hemičar'
);
const everyoneElse = people.filter(person =>
- person.profession !== 'chemist'
+ person.profession !== 'hemičar'
);
return (
- Scientists
- Chemists
+ Naučnici
+ Hemičari
- Everyone Else
+ Svi ostali
-In this solution, the `map` calls are placed directly inline into the parent `` elements, but you could introduce variables for them if you find that more readable.
+U ovom rešenju, `map` pozivi su smešteni direktno unutar roditeljskih `` elemenata, ali možete uvesti promenljive za njih ako vam to deluje čitljivije.
-There is still a bit duplication between the rendered lists. You can go further and extract the repetitive parts into a `` component:
+I dalje postoji duplirani kod između renderovanih listi. Možete ići dalje i izdvojiti ponavljajuće delove u `` komponentu:
@@ -674,7 +686,7 @@ function ListSection({ title, people }) {
{person.name}:
{' ' + person.profession + ' '}
- known for {person.accomplishment}
+ poznat je zbog {person.accomplishment}
)}
@@ -685,20 +697,20 @@ function ListSection({ title, people }) {
export default function List() {
const chemists = people.filter(person =>
- person.profession === 'chemist'
+ person.profession === 'hemičar'
);
const everyoneElse = people.filter(person =>
- person.profession !== 'chemist'
+ person.profession !== 'hemičar'
);
return (
- Scientists
+ Naučnici
@@ -710,32 +722,32 @@ export default function List() {
export const people = [{
id: 0,
name: 'Creola Katherine Johnson',
- profession: 'mathematician',
- accomplishment: 'spaceflight calculations',
+ profession: 'matematičar',
+ accomplishment: 'formula za svemirske letove',
imageId: 'MK3eW3A'
}, {
id: 1,
name: 'Mario José Molina-Pasquel Henríquez',
- profession: 'chemist',
- accomplishment: 'discovery of Arctic ozone hole',
+ profession: 'hemičar',
+ accomplishment: 'otkriće Arktičke rupe u ozonu',
imageId: 'mynHUSa'
}, {
id: 2,
name: 'Mohammad Abdus Salam',
- profession: 'physicist',
- accomplishment: 'electromagnetism theory',
+ profession: 'fizičar',
+ accomplishment: 'teorija o elektromagnetizmu',
imageId: 'bE7W1ji'
}, {
id: 3,
name: 'Percy Lavon Julian',
- profession: 'chemist',
- accomplishment: 'pioneering cortisone drugs, steroids and birth control pills',
+ profession: 'hemičar',
+ accomplishment: 'pionirski kortizon, steroidi i pilule za kontrolu rađanja',
imageId: 'IOjWm71'
}, {
id: 4,
name: 'Subrahmanyan Chandrasekhar',
- profession: 'astrophysicist',
- accomplishment: 'white dwarf star mass calculations',
+ profession: 'astrofizičar',
+ accomplishment: 'računanje mase belog patuljka',
imageId: 'lrWQx8l'
}];
```
@@ -764,9 +776,9 @@ img { width: 100px; height: 100px; border-radius: 50%; }
-A very attentive reader might notice that with two `filter` calls, we check each person's profession twice. Checking a property is very fast, so in this example it's fine. If your logic was more expensive than that, you could replace the `filter` calls with a loop that manually constructs the arrays and checks each person once.
+Veoma pažljiv čitalac može primetiti da sa dva `filter` poziva proveravamo profesiju svake osobe dvaput. Proveravanje polja je veoma brzo, pa je u ovom primeru u redu. Ako je vaša logika komplikovanija od toga, možete zameniti `filter` pozive sa petljom koja ručno pravi nizove i proverava svaku osobu jednom.
-In fact, if `people` never change, you could move this code out of your component. From React's perspective, all that matters is that you give it an array of JSX nodes in the end. It doesn't care how you produce that array:
+U suštini, ako se `people` nikad ne menja, možete pomeriti ovaj kod izvan komponente. Iz perspektive React-a, bitno je samo da mu na kraju date niz JSX čvorova. Njega ne zanima kako vi dobijate taj niz:
@@ -777,7 +789,7 @@ import { getImageUrl } from './utils.js';
let chemists = [];
let everyoneElse = [];
people.forEach(person => {
- if (person.profession === 'chemist') {
+ if (person.profession === 'hemičar') {
chemists.push(person);
} else {
everyoneElse.push(person);
@@ -798,7 +810,7 @@ function ListSection({ title, people }) {
{person.name}:
{' ' + person.profession + ' '}
- known for {person.accomplishment}
+ poznat je zbog {person.accomplishment}
)}
@@ -810,13 +822,13 @@ function ListSection({ title, people }) {
export default function List() {
return (
- Scientists
+ Naučnici
@@ -828,32 +840,32 @@ export default function List() {
export const people = [{
id: 0,
name: 'Creola Katherine Johnson',
- profession: 'mathematician',
- accomplishment: 'spaceflight calculations',
+ profession: 'matematičar',
+ accomplishment: 'formula za svemirske letove',
imageId: 'MK3eW3A'
}, {
id: 1,
name: 'Mario José Molina-Pasquel Henríquez',
- profession: 'chemist',
- accomplishment: 'discovery of Arctic ozone hole',
+ profession: 'hemičar',
+ accomplishment: 'otkriće Arktičke rupe u ozonu',
imageId: 'mynHUSa'
}, {
id: 2,
name: 'Mohammad Abdus Salam',
- profession: 'physicist',
- accomplishment: 'electromagnetism theory',
+ profession: 'fizičar',
+ accomplishment: 'teorija o elektromagnetizmu',
imageId: 'bE7W1ji'
}, {
id: 3,
name: 'Percy Lavon Julian',
- profession: 'chemist',
- accomplishment: 'pioneering cortisone drugs, steroids and birth control pills',
+ profession: 'hemičar',
+ accomplishment: 'pionirski kortizon, steroidi i pilule za kontrolu rađanja',
imageId: 'IOjWm71'
}, {
id: 4,
name: 'Subrahmanyan Chandrasekhar',
- profession: 'astrophysicist',
- accomplishment: 'white dwarf star mass calculations',
+ profession: 'astrofizičar',
+ accomplishment: 'računanje mase belog patuljka',
imageId: 'lrWQx8l'
}];
```
@@ -884,13 +896,13 @@ img { width: 100px; height: 100px; border-radius: 50%; }
-#### Nested lists in one component {/*nested-lists-in-one-component*/}
+#### Ugnježdene liste u jednoj komponenti {/*nested-lists-in-one-component*/}
-Make a list of recipes from this array! For each recipe in the array, display its name as an `` and list its ingredients in a ``.
+Napravite listu recepata od ovog niza! Za svaki recept u nizu, prikažite mu ime kao `` i listu sastojaka u ``-u.
-This will require nesting two different `map` calls.
+Ovo će zahtevati da ugnjezdite dva različita `map` poziva.
@@ -902,7 +914,7 @@ import { recipes } from './data.js';
export default function RecipeList() {
return (
-
Recipes
+ Recepti
);
}
@@ -911,16 +923,16 @@ export default function RecipeList() {
```js src/data.js
export const recipes = [{
id: 'greek-salad',
- name: 'Greek Salad',
- ingredients: ['tomatoes', 'cucumber', 'onion', 'olives', 'feta']
+ name: 'Grčka salata',
+ ingredients: ['paradajz', 'krastavci', 'crni luk', 'masline', 'feta']
}, {
id: 'hawaiian-pizza',
- name: 'Hawaiian Pizza',
- ingredients: ['pizza crust', 'pizza sauce', 'mozzarella', 'ham', 'pineapple']
+ name: 'Havajska pica',
+ ingredients: ['kora za picu', 'sos za picu', 'mocarela', 'šunka', 'ananas']
}, {
id: 'hummus',
- name: 'Hummus',
- ingredients: ['chickpeas', 'olive oil', 'garlic cloves', 'lemon', 'tahini']
+ name: 'Humus',
+ ingredients: ['leblebija', 'maslinovo ulje', 'čen belog luka', 'limun', 'tahini']
}];
```
@@ -928,7 +940,7 @@ export const recipes = [{
-Here is one way you could go about it:
+Evo jednog načina kako to možete uraditi:
@@ -938,7 +950,7 @@ import { recipes } from './data.js';
export default function RecipeList() {
return (
-
Recipes
+
Recepti
{recipes.map(recipe =>
{recipe.name}
@@ -959,28 +971,28 @@ export default function RecipeList() {
```js src/data.js
export const recipes = [{
id: 'greek-salad',
- name: 'Greek Salad',
- ingredients: ['tomatoes', 'cucumber', 'onion', 'olives', 'feta']
+ name: 'Grčka salata',
+ ingredients: ['paradajz', 'krastavci', 'crni luk', 'masline', 'feta']
}, {
id: 'hawaiian-pizza',
- name: 'Hawaiian Pizza',
- ingredients: ['pizza crust', 'pizza sauce', 'mozzarella', 'ham', 'pineapple']
+ name: 'Havajska pica',
+ ingredients: ['kora za picu', 'sos za picu', 'mocarela', 'šunka', 'ananas']
}, {
id: 'hummus',
- name: 'Hummus',
- ingredients: ['chickpeas', 'olive oil', 'garlic cloves', 'lemon', 'tahini']
+ name: 'Humus',
+ ingredients: ['leblebija', 'maslinovo ulje', 'čen belog luka', 'limun', 'tahini']
}];
```
-Each of the `recipes` already includes an `id` field, so that's what the outer loop uses for its `key`. There is no ID you could use to loop over ingredients. However, it's reasonable to assume that the same ingredient won't be listed twice within the same recipe, so its name can serve as a `key`. Alternatively, you could change the data structure to add IDs, or use index as a `key` (with the caveat that you can't safely reorder ingredients).
+Svaka stavka u `recipes` već uključuje `id` polje, tako da se to koristi kao `key` u spoljašnjoj petlji. Ne postoji ID koji možete koristiti da prolazite kroz sastojke. Međutim, razumno je pretpostaviti da isti sastojak neće biti dvaput nabrojan u jednom receptu, tako da njegovo ime može služiti kao `key`. Alternativno, možete promeniti strukturu podataka i dodati ID-eve, ili koristiti indeks kao `key` (uz upozorenje da ne možete sigurno menjati redosled sastojaka).
-#### Extracting a list item component {/*extracting-a-list-item-component*/}
+#### Izdvojiti stavku liste u komponentu {/*extracting-a-list-item-component*/}
-This `RecipeList` component contains two nested `map` calls. To simplify it, extract a `Recipe` component from it which will accept `id`, `name`, and `ingredients` props. Where do you place the outer `key` and why?
+Ova `RecipeList` komponenta sadrži dva ugnježdena `map` poziva. Da biste je pojednostavili, izdvojite `Recipe` komponentu iz nje koja će primiti `id`, `name` i `ingredients` props-e. Gde ćete smestiti spoljašni `key` i zašto?
@@ -990,7 +1002,7 @@ import { recipes } from './data.js';
export default function RecipeList() {
return (
-
Recipes
+
Recepti
{recipes.map(recipe =>
{recipe.name}
@@ -1011,16 +1023,16 @@ export default function RecipeList() {
```js src/data.js
export const recipes = [{
id: 'greek-salad',
- name: 'Greek Salad',
- ingredients: ['tomatoes', 'cucumber', 'onion', 'olives', 'feta']
+ name: 'Grčka salata',
+ ingredients: ['paradajz', 'krastavci', 'crni luk', 'masline', 'feta']
}, {
id: 'hawaiian-pizza',
- name: 'Hawaiian Pizza',
- ingredients: ['pizza crust', 'pizza sauce', 'mozzarella', 'ham', 'pineapple']
+ name: 'Havajska pica',
+ ingredients: ['kora za picu', 'sos za picu', 'mocarela', 'šunka', 'ananas']
}, {
id: 'hummus',
- name: 'Hummus',
- ingredients: ['chickpeas', 'olive oil', 'garlic cloves', 'lemon', 'tahini']
+ name: 'Humus',
+ ingredients: ['leblebija', 'maslinovo ulje', 'čen belog luka', 'limun', 'tahini']
}];
```
@@ -1028,7 +1040,7 @@ export const recipes = [{
-You can copy-paste the JSX from the outer `map` into a new `Recipe` component and return that JSX. Then you can change `recipe.name` to `name`, `recipe.id` to `id`, and so on, and pass them as props to the `Recipe`:
+Možete kopirati i nalepiti JSX iz spoljašnjeg `map`-a u novu `Recipe` komponentu i vratiti taj JSX. Onda, možete promeniti `recipe.name` u `name`, `recipe.id` u `id`, i tako dalje, prosleđujući ih kao props u `Recipe`:
@@ -1053,7 +1065,7 @@ function Recipe({ id, name, ingredients }) {
export default function RecipeList() {
return (
-
Recipes
+
Recepti
{recipes.map(recipe =>
)}
@@ -1065,30 +1077,30 @@ export default function RecipeList() {
```js src/data.js
export const recipes = [{
id: 'greek-salad',
- name: 'Greek Salad',
- ingredients: ['tomatoes', 'cucumber', 'onion', 'olives', 'feta']
+ name: 'Grčka salata',
+ ingredients: ['paradajz', 'krastavci', 'crni luk', 'masline', 'feta']
}, {
id: 'hawaiian-pizza',
- name: 'Hawaiian Pizza',
- ingredients: ['pizza crust', 'pizza sauce', 'mozzarella', 'ham', 'pineapple']
+ name: 'Havajska pica',
+ ingredients: ['kora za picu', 'sos za picu', 'mocarela', 'šunka', 'ananas']
}, {
id: 'hummus',
- name: 'Hummus',
- ingredients: ['chickpeas', 'olive oil', 'garlic cloves', 'lemon', 'tahini']
+ name: 'Humus',
+ ingredients: ['leblebija', 'maslinovo ulje', 'čen belog luka', 'limun', 'tahini']
}];
```
-Here, `
` is a syntax shortcut saying "pass all properties of the `recipe` object as props to the `Recipe` component". You could also write each prop explicitly: `
`.
+Ovde, `
` je sintaksna skraćenica za "prosleđivanje svih polja `recipe` objekta kao props u `Recipe` komponentu". Možete napisati i svaki prop eksplicitno: `
`.
-**Note that the `key` is specified on the `
` itself rather than on the root `` returned from `Recipe`.** This is because this `key` is needed directly within the context of the surrounding array. Previously, you had an array of `
`s so each of them needed a `key`, but now you have an array of `
`s. In other words, when you extract a component, don't forget to leave the `key` outside the JSX you copy and paste.
+**Primetite da je `key` specificiran na samom `` umesto na root `` elementu vraćenom iz `Recipe`.** Razlog tome je zato što je ovaj `key` direktno potreban u kontekstu okružujućeg niza. Ranije ste imali niz `
`-ova pa je svakom od njih bio potreban `key`, ali sada imate niz `
`-ova. Drugim rečima, kada izdvajate komponentu, ne zaboravite da `key` ostavite izvan JSX-a koji kopirate i nalepite.
-#### List with a separator {/*list-with-a-separator*/}
+#### Lista sa separatorom {/*list-with-a-separator*/}
-This example renders a famous haiku by Tachibana Hokushi, with each line wrapped in a `` tag. Your job is to insert an `
` separator between each paragraph. Your resulting structure should look like this:
+Ovaj primer renderuje poznatu haiku koju je napisao Tachibana Hokushi, gde je svaka linija obmotana `` tag-om. Vaš posao je da ubacite `
` separator između paragrafa. Rezultat treba da izgleda ovako:
```js
@@ -1100,7 +1112,7 @@ This example renders a famous haiku by Tachibana Hokushi, with each line wrapped
```
-A haiku only contains three lines, but your solution should work with any number of lines. Note that `
` elements only appear *between* the `` elements, not in the beginning or the end!
+Haiku sadrži samo tri linije, ali vaše rešenje treba raditi za bilo koji broj linija. Zapazite da se `
` elementi pojavljuju samo *između* `` elemenata, ali ne na početku i kraju!
@@ -1143,17 +1155,17 @@ hr {
-(This is a rare case where index as a key is acceptable because a poem's lines will never reorder.)
+(Ovo je redak primer gde je indeks kao ključ prihvatljiv, jer se redosled linija u pesmama nikad ne menja.)
-You'll either need to convert `map` to a manual loop, or use a Fragment.
+Moraćete ili da pretvorite `map` u petlju, ili da koristite Fragment.
-You can write a manual loop, inserting `
` and `...
` into the output array as you go:
+Možete ručno napisati petlju ubacivanjem `
` i `...
` u izlazni niz:
@@ -1169,7 +1181,7 @@ const poem = {
export default function Poem() {
let output = [];
- // Fill the output array
+ // Popunite izlazni niz
poem.lines.forEach((line, i) => {
output.push(
@@ -1180,7 +1192,7 @@ export default function Poem() {
);
});
- // Remove the first
+ // Obrišite prvi
output.shift();
return (
@@ -1208,9 +1220,9 @@ hr {
-Using the original line index as a `key` doesn't work anymore because each separator and paragraph are now in the same array. However, you can give each of them a distinct key using a suffix, e.g. `key={i + '-text'}`.
+Upotreba indeksa originalne linije za `key` više ne radi jer su i separatori i paragrafi sada u istom nizu. Međutim, svakom od njih možete dati jedinstven ključ upotrebom sufiksa, npr. `key={i + '-text'}`.
-Alternatively, you could render a collection of Fragments which contain `
` and `...
`. However, the `<>...>` shorthand syntax doesn't support passing keys, so you'd have to write `` explicitly:
+Alternativno, možete renderovati kolekciju Fragment-a koji sadrže `
` i `...
`. Međutim, `<>...>` sintaksna skraćenica ne podržava prosleđivanje ključeva, pa morate napisati `` eksplicitno:
@@ -1256,7 +1268,7 @@ hr {
-Remember, Fragments (often written as `<> >`) let you group JSX nodes without adding extra ``s!
+Upamtite, Fragment-i (češće napisani kao `<> >`) vam omogućavaju da grupišete JSX čvorove bez dodavanja `
`-ova!
diff --git a/src/content/learn/thinking-in-react.md b/src/content/learn/thinking-in-react.md
index 2ff945d7..46dc583e 100644
--- a/src/content/learn/thinking-in-react.md
+++ b/src/content/learn/thinking-in-react.md
@@ -296,7 +296,7 @@ Zatim, prosledite `filterText` i `inStockOnly` u `ProductTable` i `SearchBar` ka
```
-Gledajte kako će se vaša aplikacija ponašati. Promenite početnu vrednost `filterText`-a sa `useState('')` na `useState('voće')` u sandbox-u ispod. Videćete da su se tekst za pretragu i tabela promenili:
+Gledajte kako će se vaša aplikacija ponašati. Promenite početnu vrednost `filterText`-a sa `useState('')` na `useState('voće')` u sandbox-u ispod. Videćete da su se tekst za pretragu i tabela ažurirali: