Skip to content

Commit 758d6be

Browse files
committed
quickstart-line-380
1 parent 4436073 commit 758d6be

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/content/learn/index.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -285,40 +285,40 @@ Možete odgovarati na event-e deklarisanjem *event handler-a* funkcija za obradu
285285
```js {2-4,7}
286286
function MyButton() {
287287
function handleClick() {
288-
alert('You clicked me!');
288+
alert('Kliknuli ste me!');
289289
}
290290

291291
return (
292292
<button onClick={handleClick}>
293-
Click me
293+
Kliknite me
294294
</button>
295295
);
296296
}
297297
```
298298
299-
Notice how `onClick={handleClick}` has no parentheses at the end! Do not _call_ the event handler function: you only need to *pass it down*. React will call your event handler when the user clicks the button.
299+
Obratite pažnju na to kako `onClick={handleClick}` nema zagrade na kraju! Ne treba da *pozivate* event handler funkciju: smo je treba *proslediti*. React će pozvati vaš event handler kada korisnik klikne na dugme.
300300
301-
## Updating the screen {/*updating-the-screen*/}
301+
## Ažuriranje ekrana {/*updating-the-screen*/}
302302
303-
Often, you'll want your component to "remember" some information and display it. For example, maybe you want to count the number of times a button is clicked. To do this, add *state* to your component.
303+
Često ćete želite da vaša komponenta "zapamti" neke informacije i prikaže ih. Na primer, možda želite da prebrojite koliko puta je dugme kliknuto. To do this, add *stanje (state)* u svoju komponentu.
304304
305-
First, import [`useState`](/reference/react/useState) from React:
305+
Prvo, uvezite [`useState`](/reference/react/useState) iz React-a:
306306
307307
```js
308308
import { useState } from 'react';
309309
```
310310
311-
Now you can declare a *state variable* inside your component:
311+
Sada možete deklarisati *state varijablu* unutar vaše komponente:
312312
313313
```js
314314
function MyButton() {
315315
const [count, setCount] = useState(0);
316316
// ...
317317
```
318318
319-
You’ll get two things from `useState`: the current state (`count`), and the function that lets you update it (`setCount`). You can give them any names, but the convention is to write `[something, setSomething]`.
319+
Od`useState` dobićete dobiti dve stvari: trenutni state (`count`), i funkciju koja vam omogućava da ga ažurirate (`setCount`). Možete im dati bilo koja imena, ali je konvencija da pišete `[nešto, setNešto]`.
320320
321-
The first time the button is displayed, `count` will be `0` because you passed `0` to `useState()`. When you want to change state, call `setCount()` and pass the new value to it. Clicking this button will increment the counter:
321+
Prvi put kada se dugme prikaže, `count` će biti `0` jer ste `0` prosledili u `useState()`. Kada želite da promenite state, pozovite `setCount()` i prosledite joj novu vrednost. Klikom na ovo dugme inkrementujte brojač:
322322
323323
```js {5}
324324
function MyButton() {
@@ -330,15 +330,15 @@ function MyButton() {
330330

331331
return (
332332
<button onClick={handleClick}>
333-
Clicked {count} times
333+
Kliknuto je {count} puta
334334
</button>
335335
);
336336
}
337337
```
338338
339-
React will call your component function again. This time, `count` will be `1`. Then it will be `2`. And so on.
339+
React će ponovo pozvati funkciju vaše komponente. Ovaj put, `count` će biti `1`. Zatim će biti `2`. I tako dalje.
340340
341-
If you render the same component multiple times, each will get its own state. Click each button separately:
341+
Ako renderujete istu komponentu više puta, svaka će dobiti svoje sopstveni state. Kliknite svako dugme posebno:
342342
343343
<Sandpack>
344344
@@ -348,7 +348,7 @@ import { useState } from 'react';
348348
export default function MyApp() {
349349
return (
350350
<div>
351-
<h1>Counters that update separately</h1>
351+
<h1>Brojači koji se ažuriraju nezavisno</h1>
352352
<MyButton />
353353
<MyButton />
354354
</div>
@@ -364,7 +364,7 @@ function MyButton() {
364364

365365
return (
366366
<button onClick={handleClick}>
367-
Clicked {count} times
367+
Kliknuto je {count} puta
368368
</button>
369369
);
370370
}
@@ -379,7 +379,7 @@ button {
379379
380380
</Sandpack>
381381
382-
Notice how each button "remembers" its own `count` state and doesn't affect other buttons.
382+
Primetite kako svako dugme "pamti" svoj sopstveni state brojača `count` i ne utiče na drugu dugmad.
383383
384384
## Using Hooks {/*using-hooks*/}
385385

0 commit comments

Comments
 (0)