Skip to content

Commit 55772e6

Browse files
authored
Merge pull request #10 from cvijandj/main
New translation progress
2 parents ea96209 + 7a29823 commit 55772e6

File tree

5 files changed

+131
-127
lines changed

5 files changed

+131
-127
lines changed

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

Lines changed: 71 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
---
2-
title: Describing the UI
2+
title: Opisivanje korisničkog interfejsa (UI)
33
---
44

55
<Intro>
66

7-
React is a JavaScript library for rendering user interfaces (UI). UI is built from small units like buttons, text, and images. React lets you combine them into reusable, nestable *components.* From web sites to phone apps, everything on the screen can be broken down into components. In this chapter, you'll learn to create, customize, and conditionally display React components.
7+
React je JavaScript biblioteka za prikazivanje korisničkog interfejsa (UI). UI se sastoji od malih jedinica kao što su dugmad, tekst i slike. React vam omogućava da ih kombinujete u ponovljive, nested (ugnježdene) *komponente.* Od veb sajtova do telefonskih aplikacija, sve na ekranu može se razbiti na komponente. U ovoj glavi naučićete kako da kreirate, prilagodite i uslovno prikažete React komponente.
88

99
</Intro>
1010

1111
<YouWillLearn isChapter={true}>
1212

13-
* [How to write your first React component](/learn/your-first-component)
14-
* [When and how to create multi-component files](/learn/importing-and-exporting-components)
15-
* [How to add markup to JavaScript with JSX](/learn/writing-markup-with-jsx)
16-
* [How to use curly braces with JSX to access JavaScript functionality from your components](/learn/javascript-in-jsx-with-curly-braces)
17-
* [How to configure components with props](/learn/passing-props-to-a-component)
18-
* [How to conditionally render components](/learn/conditional-rendering)
19-
* [How to render multiple components at a time](/learn/rendering-lists)
20-
* [How to avoid confusing bugs by keeping components pure](/learn/keeping-components-pure)
13+
* [Kako da napišete svoju prvu React komponentu](/learn/your-first-component)
14+
* [Kada i kako da kreirate više komponenti u jednom fajlu](/learn/importing-and-exporting-components)
15+
* [Kako da dodate markup u JavaScript pomoću JSX](/learn/writing-markup-with-jsx)
16+
* [Kako da koristite vitičaste zagrade u JSX-u da biste pristupili funkcionalnosti JavaScript-a iz vaših komponenti](/learn/javascript-in-jsx-with-curly-braces)
17+
* [Kako da konfigurišete komponente sa props](/learn/passing-props-to-a-component)
18+
* [Kako da uslovno prikažete komponente](/learn/conditional-rendering)
19+
* [Kako da prikažete više komponenti odjednom](/learn/rendering-lists)
20+
* [Kako da izbegnete zbunjujuće greške tako što ćete komponente držati čistim](/learn/keeping-components-pure)
2121

2222
</YouWillLearn>
2323

24-
## Your first component {/*your-first-component*/}
24+
## Vaša prva komponenta {/*your-first-component*/}
2525

26-
React applications are built from isolated pieces of UI called *components*. A React component is a JavaScript function that you can sprinkle with markup. Components can be as small as a button, or as large as an entire page. Here is a `Gallery` component rendering three `Profile` components:
26+
React aplikacije su izgrađene of izoliranih delova korisničkog interfejsa (UI) koje se zovu *komponente*. React komponenta je Javascript funkcija koju možete začiniti markup-om. Komponente mogu biti male kao dugme ili velike kao cela stranica. Ovde je `Gallery` komponenta koja prikazuje tri `Profile` komponente:
2727

2828
<Sandpack>
2929

@@ -40,7 +40,7 @@ function Profile() {
4040
export default function Gallery() {
4141
return (
4242
<section>
43-
<h1>Amazing scientists</h1>
43+
<h1>Zadivljujući naučnik</h1>
4444
<Profile />
4545
<Profile />
4646
<Profile />
@@ -57,13 +57,13 @@ img { margin: 0 10px 10px 0; height: 90px; }
5757

5858
<LearnMore path="/learn/your-first-component">
5959

60-
Read **[Your First Component](/learn/your-first-component)** to learn how to declare and use React components.
60+
Pročitajte **[Vaša prva komponenta](/learn/your-first-component)** da biste naučili kako da deklarišete i koristite React komponente.
6161

6262
</LearnMore>
6363

64-
## Importing and exporting components {/*importing-and-exporting-components*/}
64+
## Importovanje i exportovanje komponenti {/*importing-and-exporting-components*/}
6565

66-
You can declare many components in one file, but large files can get difficult to navigate. To solve this, you can *export* a component into its own file, and then *import* that component from another file:
66+
Možete deklarisati mnogo komponenti u jednom fajlu, ali veliki fajlovi mogu postati teški za navigaciju. Da biste to rešili, možete *exportovati* komponentu u svoj fajl, a zatim *importovati* tu komponentu iz drugog fajla:
6767

6868

6969
<Sandpack>
@@ -84,7 +84,7 @@ import Profile from './Profile.js';
8484
export default function Gallery() {
8585
return (
8686
<section>
87-
<h1>Amazing scientists</h1>
87+
<h1>Zadivljujući naučnik</h1>
8888
<Profile />
8989
<Profile />
9090
<Profile />
@@ -112,32 +112,32 @@ img { margin: 0 10px 10px 0; }
112112

113113
<LearnMore path="/learn/importing-and-exporting-components">
114114

115-
Read **[Importing and Exporting Components](/learn/importing-and-exporting-components)** to learn how to split components into their own files.
115+
Pročitajte **[Importovanje i exportovanje komponenti](/learn/importing-and-exporting-components)** da biste naučili kako da podelite komponente u svoje fajlove.
116116

117117
</LearnMore>
118118

119-
## Writing markup with JSX {/*writing-markup-with-jsx*/}
119+
## Pisanje markup-a sa JSX {/*writing-markup-with-jsx*/}
120120

121-
Each React component is a JavaScript function that may contain some markup that React renders into the browser. React components use a syntax extension called JSX to represent that markup. JSX looks a lot like HTML, but it is a bit stricter and can display dynamic information.
121+
Svaka React komponenta je JavaScript funkcija koja može sadržati neki markup koji React prikazuje u browser-u. React komponente koriste sintaksu proširenja zvanu JSX da predstave taj markup. JSX izgleda mnogo kao HTML, ali je malo stroži i može prikazati dinamičke informacije.
122122

123-
If we paste existing HTML markup into a React component, it won't always work:
123+
Ako kopirate postojeći HTML markup u React komponentu, neće uvek raditi:
124124

125125
<Sandpack>
126126

127127
```js
128128
export default function TodoList() {
129129
return (
130130
// This doesn't quite work!
131-
<h1>Hedy Lamarr's Todos</h1>
131+
<h1>Hedy Lamarr's Todo lista</h1>
132132
<img
133133
src="https://i.imgur.com/yXOvdOSs.jpg"
134134
alt="Hedy Lamarr"
135135
class="photo"
136136
>
137137
<ul>
138-
<li>Invent new traffic lights
139-
<li>Rehearse a movie scene
140-
<li>Improve spectrum technology
138+
<li>Izmisli nove semafore
139+
<li>Vežbaj scenu iz filma
140+
<li>Unapredi tehnologiju spektra
141141
</ul>
142142
);
143143
}
@@ -149,7 +149,7 @@ img { height: 90px; }
149149
150150
</Sandpack>
151151
152-
If you have existing HTML like this, you can fix it using a [converter](https://transform.tools/html-to-jsx):
152+
Ako imate postojeći HTML kao što je ovaj, možete ga popraviti pomoću [konvertera](https://transform.tools/html-to-jsx):
153153
154154
<Sandpack>
155155
@@ -164,9 +164,9 @@ export default function TodoList() {
164164
className="photo"
165165
/>
166166
<ul>
167-
<li>Invent new traffic lights</li>
168-
<li>Rehearse a movie scene</li>
169-
<li>Improve spectrum technology</li>
167+
<li>Izmisli nove semafore</li>
168+
<li>Vežbaj scenu iz filma</li>
169+
<li>Unapredi tehnologiju spektra</li>
170170
</ul>
171171
</>
172172
);
@@ -181,13 +181,13 @@ img { height: 90px; }
181181

182182
<LearnMore path="/learn/writing-markup-with-jsx">
183183

184-
Read **[Writing Markup with JSX](/learn/writing-markup-with-jsx)** to learn how to write valid JSX.
184+
Pročitajte **[Pisanje markup-a sa JSX](/learn/writing-markup-with-jsx)** da biste naučili kako da napišete validan JSX.
185185

186186
</LearnMore>
187187

188-
## JavaScript in JSX with curly braces {/*javascript-in-jsx-with-curly-braces*/}
188+
## JavaScript u JSX-u sa vitičastim zagradama {/*javascript-in-jsx-with-curly-braces*/}
189189

190-
JSX lets you write HTML-like markup inside a JavaScript file, keeping rendering logic and content in the same place. Sometimes you will want to add a little JavaScript logic or reference a dynamic property inside that markup. In this situation, you can use curly braces in your JSX to "open a window" to JavaScript:
190+
JSX vam dozvoljava da pišete HTML sličan markup unutar JavaScript fajla, čuvajući logiku prikazivanja i sadržaja na istom mestu. Ponekad ćete želeti da dodate malo JavaScript logike ili da referencirate dinamičko svojstvo unutar tog markup-a. U ovoj situaciji možete koristiti vitičaste zagrade u vašem JSX-u da "otvorite prozor" ka JavaScript-u:
191191

192192
<Sandpack>
193193

@@ -210,9 +210,9 @@ export default function TodoList() {
210210
alt="Gregorio Y. Zara"
211211
/>
212212
<ul>
213-
<li>Improve the videophone</li>
214-
<li>Prepare aeronautics lectures</li>
215-
<li>Work on the alcohol-fuelled engine</li>
213+
<li>Unapredi the videophone</li>
214+
<li>Pripremi predavanja iz aeronautike</li>
215+
<li>Radi na motoru koji radi na alkohol</li>
216216
</ul>
217217
</div>
218218
);
@@ -229,13 +229,13 @@ body > div > div { padding: 20px; }
229229
230230
<LearnMore path="/learn/javascript-in-jsx-with-curly-braces">
231231
232-
Read **[JavaScript in JSX with Curly Braces](/learn/javascript-in-jsx-with-curly-braces)** to learn how to access JavaScript data from JSX.
232+
Pročitajte **[JavaScript u JSX-u sa vitičastim zagradama](/learn/javascript-in-jsx-with-curly-braces)** da biste naučili kako da pristupite JavaScript podacima iz JSX-a.
233233
234234
</LearnMore>
235235
236-
## Passing props to a component {/*passing-props-to-a-component*/}
236+
## Prosleđivanje props-a komponenti {/*passing-props-to-a-component*/}
237237
238-
React components use *props* to communicate with each other. Every parent component can pass some information to its child components by giving them props. Props might remind you of HTML attributes, but you can pass any JavaScript value through them, including objects, arrays, functions, and even JSX!
238+
React komponente koriste *props* da bi komunicirale jedna sa drugom. Svaki roditeljski(parent) komponent može proslediti neke informacije svojoj deci(children) pomoću props-a. Props vam mogu podsetiti na HTML atribute, ali možete proslediti bilo koju JavaScript vrednost kroz njih, uključujući objekte, nizove, funkcije i čak JSX!
239239
240240
<Sandpack>
241241
@@ -310,15 +310,15 @@ export function getImageUrl(person, size = 's') {
310310

311311
<LearnMore path="/learn/passing-props-to-a-component">
312312

313-
Read **[Passing Props to a Component](/learn/passing-props-to-a-component)** to learn how to pass and read props.
313+
Pročitajte **[Prosleđivanje props-a komponenti](/learn/passing-props-to-a-component)** da biste naučili kako da prosledite i čitate props.
314314

315315
</LearnMore>
316316

317-
## Conditional rendering {/*conditional-rendering*/}
317+
## Uslovno prikazivanje komponenti {/*conditional-rendering*/}
318318

319-
Your components will often need to display different things depending on different conditions. In React, you can conditionally render JSX using JavaScript syntax like `if` statements, `&&`, and `? :` operators.
319+
Vaše komponente će često morati da prikažu različite stvari u zavisnosti od različitih uslova. U React-u, možete uslovno prikazati JSX koristeći JavaScript sintaksu kao što su `if` naredbe, `&&` i `? :` operatori.
320320

321-
In this example, the JavaScript `&&` operator is used to conditionally render a checkmark:
321+
U ovom primeru, JavaScript `&&` operator se koristi da bi se uslovno prikazala kvačica:
322322

323323
<Sandpack>
324324

@@ -334,19 +334,19 @@ function Item({ name, isPacked }) {
334334
export default function PackingList() {
335335
return (
336336
<section>
337-
<h1>Sally Ride's Packing List</h1>
337+
<h1>Sally Ride lista za pakovanje</h1>
338338
<ul>
339339
<Item
340340
isPacked={true}
341-
name="Space suit"
341+
name="Svemirsko odelo"
342342
/>
343343
<Item
344344
isPacked={true}
345-
name="Helmet with a golden leaf"
345+
name="Kaciga sa zlatnim listom"
346346
/>
347347
<Item
348348
isPacked={false}
349-
name="Photo of Tam"
349+
name="Foto od Tam"
350350
/>
351351
</ul>
352352
</section>
@@ -358,15 +358,15 @@ export default function PackingList() {
358358

359359
<LearnMore path="/learn/conditional-rendering">
360360

361-
Read **[Conditional Rendering](/learn/conditional-rendering)** to learn the different ways to render content conditionally.
361+
Pročitajte **[Uslovno prikazivanje komponenti](/learn/conditional-rendering)** da biste naučili različite načine za uslovno prikazivanje sadržaja.
362362

363363
</LearnMore>
364364

365-
## Rendering lists {/*rendering-lists*/}
365+
## Renderovanje liste {/*rendering-lists*/}
366366

367-
You will often want to display multiple similar components from a collection of data. You can use JavaScript's `filter()` and `map()` with React to filter and transform your array of data into an array of components.
367+
Često ćete želeti da prikažete više sličnih komponenti iz kolekcije podataka. Možete koristiti JavaScript `filter()` i `map()` sa React-om da biste filtrirali i transformisali vaš niz podataka u niz komponenti.
368368

369-
For each array item, you will need to specify a `key`. Usually, you will want to use an ID from the database as a `key`. Keys let React keep track of each item's place in the list even if the list changes.
369+
Za svaki element u nizu, moraćete da odredite `key` prop. Obično ćete koristiti ID iz baze podataka kao `key`. Ključevi omogućavaju React-u da prati mesto svakog elementa u listi čak i ako se lista promeni.
370370

371371
<Sandpack>
372372

@@ -384,7 +384,7 @@ export default function List() {
384384
<p>
385385
<b>{person.name}:</b>
386386
{' ' + person.profession + ' '}
387-
known for {person.accomplishment}
387+
poznat je zbog {person.accomplishment}
388388
</p>
389389
</li>
390390
);
@@ -402,31 +402,31 @@ export const people = [{
402402
id: 0,
403403
name: 'Creola Katherine Johnson',
404404
profession: 'mathematician',
405-
accomplishment: 'spaceflight calculations',
405+
accomplishment: 'formula za svemirske letove',
406406
imageId: 'MK3eW3A'
407407
}, {
408408
id: 1,
409409
name: 'Mario José Molina-Pasquel Henríquez',
410410
profession: 'chemist',
411-
accomplishment: 'discovery of Arctic ozone hole',
411+
accomplishment: 'otkriće Arktičke rupe u ozonu',
412412
imageId: 'mynHUSa'
413413
}, {
414414
id: 2,
415415
name: 'Mohammad Abdus Salam',
416416
profession: 'physicist',
417-
accomplishment: 'electromagnetism theory',
417+
accomplishment: 'teorija o elektromagnetizmu',
418418
imageId: 'bE7W1ji'
419419
}, {
420420
id: 3,
421421
name: 'Percy Lavon Julian',
422422
profession: 'chemist',
423-
accomplishment: 'pioneering cortisone drugs, steroids and birth control pills',
423+
accomplishment: 'pionirski kortizon, steroide i pilule za kontrolu rađanja',
424424
imageId: 'IOjWm71'
425425
}, {
426426
id: 4,
427427
name: 'Subrahmanyan Chandrasekhar',
428428
profession: 'astrophysicist',
429-
accomplishment: 'white dwarf star mass calculations',
429+
accomplishment: 'računanje mase belog patuljka',
430430
imageId: 'lrWQx8l'
431431
}];
432432
```
@@ -458,18 +458,19 @@ h2 { font-size: 20px; }
458458

459459
<LearnMore path="/learn/rendering-lists">
460460

461-
Read **[Rendering Lists](/learn/rendering-lists)** to learn how to render a list of components, and how to choose a key.
461+
Pročitajte **[Renderovanje liste](/learn/rendering-lists)** da biste naučili kako da renderujete listu komponenti i kako da odaberete ključ.
462462

463463
</LearnMore>
464464

465-
## Keeping components pure {/*keeping-components-pure*/}
465+
## Održavanje komponenti čistim (Pure components) {/*keeping-components-pure*/}
466466

467-
Some JavaScript functions are *pure.* A pure function:
467+
Neke JavaScript funkcije su *čiste.* Čista funkcija:
468468

469-
* **Minds its own business.** It does not change any objects or variables that existed before it was called.
470-
* **Same inputs, same output.** Given the same inputs, a pure function should always return the same result.
469+
* **Gleda svoj posao.** Ne zavisi od bilo kakvih globalnih promenljivih ili stanja aplikacije.
470+
* **Isti input, isti output.** Dajući isti input, čista funkcija uvek treba da vrati isti rezultat.
471+
472+
Striktno pisanje vaših komponenti kao čistih funkcija može da izbegne čitavu klasu zbunjujućih grešaka i nepredvidivog ponašanja kako vaša baza koda raste. Ovde je primer nečiste komponente:
471473

472-
By strictly only writing your components as pure functions, you can avoid an entire class of baffling bugs and unpredictable behavior as your codebase grows. Here is an example of an impure component:
473474

474475
<Sandpack>
475476

@@ -479,7 +480,7 @@ let guest = 0;
479480
function Cup() {
480481
// Bad: changing a preexisting variable!
481482
guest = guest + 1;
482-
return <h2>Tea cup for guest #{guest}</h2>;
483+
return <h2>Šolja čaja za gosta #{guest}</h2>;
483484
}
484485

485486
export default function TeaSet() {
@@ -495,13 +496,13 @@ export default function TeaSet() {
495496

496497
</Sandpack>
497498

498-
You can make this component pure by passing a prop instead of modifying a preexisting variable:
499+
Možete napraviti ovu komponentu čistom tako što ćete proslediti prop umesto što ćete modifikovati prethodno postojeću promenljivu:
499500

500501
<Sandpack>
501502

502503
```js
503504
function Cup({ guest }) {
504-
return <h2>Tea cup for guest #{guest}</h2>;
505+
return <h2>Šolja čaja za gosta #{guest}</h2>;
505506
}
506507

507508
export default function TeaSet() {
@@ -519,12 +520,13 @@ export default function TeaSet() {
519520

520521
<LearnMore path="/learn/keeping-components-pure">
521522

522-
Read **[Keeping Components Pure](/learn/keeping-components-pure)** to learn how to write components as pure, predictable functions.
523+
Pročitajte **[Održavanje komponenti čistim](/learn/keeping-components-pure)** da biste naučili kako da napišete komponente kao čiste funkcije.
523524

524525
</LearnMore>
525526

526-
## What's next? {/*whats-next*/}
527+
## Šta dalje? {/*whats-next*/}
528+
529+
Idite do [Vaša prva komponenta](/learn/your-first-component) da biste počeli da čitate ovo poglavlje stranicu po stranicu!
527530

528-
Head over to [Your First Component](/learn/your-first-component) to start reading this chapter page by page!
531+
Ili ako ste već upoznati sa ovim temama, zašto ne biste pročitali o [Dodavanju interaktivnosti](/learn/adding-interactivity)?
529532

530-
Or, if you're already familiar with these topics, why not read about [Adding Interactivity](/learn/adding-interactivity)?

0 commit comments

Comments
 (0)