You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Hooks* let you use different React features from your components. You can either use the built-in Hooks or combine them to build your own. This page lists all built-in Hooks in React.
7
+
*Hook-ovi* vam omogućavaju upotrebu različitih React funkcionalnosti u vašim komponentama. Možete koristiti ugrađene Hook-ove ili ih kombinovati da napravite svoje. Na ovoj stranici se nalaze svi ugrađeni Hook-ovi u React-u.
8
8
9
9
</Intro>
10
10
11
11
---
12
12
13
-
## State Hooks {/*state-hooks*/}
13
+
## State Hook-ovi {/*state-hooks*/}
14
14
15
-
*State*lets a component["remember" information like user input.](/learn/state-a-components-memory) For example, a form component can use state to store the input value, while an image gallery component can use state to store the selected image index.
15
+
*State*omogućava komponenti da["zapamti" informaciju poput korisničkog input-a](/learn/state-a-components-memory). Na primer, form komponenta može koristiti state da čuva input vrednost, dok komponenta za galeriju slika može koristiti state da čuva indeks izabrane slike.
16
16
17
-
To add state to a component, use one of these Hooks:
17
+
Da biste dodali state u komponentu, koristite jedan od ovih Hook-ova:
18
18
19
-
*[`useState`](/reference/react/useState)declares a state variable that you can update directly.
20
-
*[`useReducer`](/reference/react/useReducer)declares a state variable with the update logic inside a [reducer function.](/learn/extracting-state-logic-into-a-reducer)
19
+
*[`useState`](/reference/react/useState)deklariše state promenljivu koju direktno možete ažurirati.
20
+
*[`useReducer`](/reference/react/useReducer)deklariše state promenljivu sa logikom ažuriranja unutar [reducer funkcije](/learn/extracting-state-logic-into-a-reducer).
21
21
22
22
```js
23
23
functionImageGallery() {
@@ -27,11 +27,11 @@ function ImageGallery() {
27
27
28
28
---
29
29
30
-
## Context Hooks {/*context-hooks*/}
30
+
## Context Hook-ovi {/*context-hooks*/}
31
31
32
-
*Context* lets a component [receive information from distant parents without passing it as props.](/learn/passing-props-to-a-component) For example, your app's top-level component can pass the current UI theme to all components below, no matter how deep.
32
+
*Context* omogućava komponenti da [prima informacije od udaljenih roditelja bez prosleđivanja informacije kao props](/learn/passing-props-to-a-component). Na primer, vaša komponenta na vrhu može proslediti trenutnu temu svim komponentama ispod, bez obzira koliko su duboko.
33
33
34
-
* [`useContext`](/reference/react/useContext) reads and subscribes to a context.
34
+
* [`useContext`](/reference/react/useContext) čita i pretplaćuje se na context.
35
35
36
36
```js
37
37
functionButton() {
@@ -41,12 +41,12 @@ function Button() {
41
41
42
42
---
43
43
44
-
## Ref Hooks {/*ref-hooks*/}
44
+
## Ref Hook-ovi {/*ref-hooks*/}
45
45
46
-
*Refs* let a component [hold some information that isn't used for rendering,](/learn/referencing-values-with-refs) like a DOM node or a timeout ID. Unlike with state, updating a ref does not re-render your component. Refs are an "escape hatch" from the React paradigm. They are useful when you need to work with non-React systems, such as the built-in browser APIs.
46
+
*Ref-ovi* omogućavaju komponenti da [čuva informaciju koja se ne koristi za renderovanje](/learn/referencing-values-with-refs), kao što je DOM čvor ili timeout ID. Za razliku od state-a, ažuriranje ref-a ne renderuje komponentu ponovo. Ref-ovi su "evakuacioni izlaz" u React paradigmi. Korisni su kada trebate raditi sa sistemima koji nisu React, poput ugrađenih API-ja u pretraživaču.
47
47
48
-
* [`useRef`](/reference/react/useRef) declares a ref. You can hold any value in it, but most often it's used to hold a DOM node.
49
-
* [`useImperativeHandle`](/reference/react/useImperativeHandle) lets you customize the ref exposed by your component. This is rarely used.
48
+
* [`useRef`](/reference/react/useRef) deklariše ref. Možete čuvati bilo koju vrednosti u njoj, ali se najčešće koristi za čuvanje DOM čvora.
49
+
* [`useImperativeHandle`](/reference/react/useImperativeHandle) omogućava prilagođavanje izloženog ref-a vaše komponente. Ovo se retko koristi.
50
50
51
51
```js
52
52
functionForm() {
@@ -56,11 +56,11 @@ function Form() {
56
56
57
57
---
58
58
59
-
## Effect Hooks {/*effect-hooks*/}
59
+
## Effect Hook-ovi {/*effect-hooks*/}
60
60
61
-
*Effects* let a component [connect to and synchronize with external systems.](/learn/synchronizing-with-effects) This includes dealing with network, browser DOM, animations, widgets written using a different UI library, and other non-React code.
61
+
*Effect-i* omogućavaju komponenti da [se konektuje i sinhronizuje sa eksternim sistemima](/learn/synchronizing-with-effects). Ovo uključuje rad sa mrežom, DOM pretraživača, animacije, widget-e napisane u drugoj biblioteci i ostali kod koji nije napisan u React-u.
62
62
63
-
* [`useEffect`](/reference/react/useEffect) connects a component to an external system.
63
+
* [`useEffect`](/reference/react/useEffect) povezuje komponentu na eksterni sistem.
64
64
65
65
```js
66
66
functionChatRoom({ roomId }) {
@@ -72,23 +72,23 @@ function ChatRoom({ roomId }) {
72
72
// ...
73
73
```
74
74
75
-
Effects are an "escape hatch" from the React paradigm. Don't use Effects to orchestrate the data flow of your application. If you're not interacting with an external system, [you might not need an Effect.](/learn/you-might-not-need-an-effect)
75
+
Effect-i su "evakuacioni izlaz" u React paradigmi. Nemojte koristiti Effect-e da orkestrirate tok podataka u vašoj aplikaciji. Ako ne interagujete sa eksternim sistemom, [možda vam neće biti potreban Effect](/learn/you-might-not-need-an-effect).
76
76
77
-
There are two rarely used variations of `useEffect` with differences in timing:
77
+
Postoje dve retko korišćene varijante `useEffect`-a sa razlikama u tajmingu:
78
78
79
-
* [`useLayoutEffect`](/reference/react/useLayoutEffect) fires before the browser repaints the screen. You can measure layout here.
80
-
* [`useInsertionEffect`](/reference/react/useInsertionEffect) fires before React makes changes to the DOM. Libraries can insert dynamic CSS here.
79
+
* [`useLayoutEffect`](/reference/react/useLayoutEffect) se okida pre nego što pretraživač ponovo iscrta ekran. Ovde možete meriti layout.
80
+
* [`useInsertionEffect`](/reference/react/useInsertionEffect) se okida pre nego što React napravi izmene u DOM-u. Biblioteke ovde mogu ubaciti dinamički CSS.
81
81
82
82
---
83
83
84
-
## Performance Hooks {/*performance-hooks*/}
84
+
## Hook-ovi performansi {/*performance-hooks*/}
85
85
86
-
A common way to optimize re-rendering performance is to skip unnecessary work. For example, you can tell React to reuse a cached calculation or to skip a re-render if the data has not changed since the previous render.
86
+
Uobičajen način za optimizaciju performansi ponovnih rendera je preskakanje nepotrebnog posla. Na primer, možete reći React-u da ponovo iskoristi keširani proračun ili da preskoči ponovni render ako se podaci nisu promenili od prethodnog rendera.
87
87
88
-
To skip calculations and unnecessary re-rendering, use one of these Hooks:
88
+
Da biste preskočili proračune i nepotrebne ponovne rendere, koristite jedan od ovih Hook-ova:
89
89
90
-
- [`useMemo`](/reference/react/useMemo) lets you cache the result of an expensive calculation.
91
-
- [`useCallback`](/reference/react/useCallback) lets you cache a function definition before passing it down to an optimized component.
90
+
- [`useMemo`](/reference/react/useMemo) vam omogućava da keširate rezultat skupog proračuna.
91
+
- [`useCallback`](/reference/react/useCallback) vam omogućava da keširate definiciju funkcije pre njenog prosleđivanja u optimizovanu komponentu.
Sometimes, you can't skip re-rendering because the screen actually needs to update. In that case, you can improve performance by separating blocking updates that must be synchronous (like typing into an input) from non-blocking updates which don't need to block the user interface (like updating a chart).
100
+
Ponekad ne možete preskočiti ponovno renderovanje, jer ekran treba da se ažurira. U tom slučaju, možete poboljšati performanse odvajanjem blokirajućih ažuriranja koja moraju biti sinhrona (poput pisanja u input) od neblokirajućih ažuriranja koja ne moraju da blokiraju korisnički interfejs (poput ažuriranja tabele).
101
101
102
-
To prioritize rendering, use one of these Hooks:
102
+
Da biste dali prioritet renderovanju, koristite jedan od ovih Hook-ova:
103
103
104
-
- [`useTransition`](/reference/react/useTransition) lets you mark a state transition as non-blocking and allow other updates to interrupt it.
105
-
- [`useDeferredValue`](/reference/react/useDeferredValue) lets you defer updating a non-critical part of the UI and let other parts update first.
104
+
- [`useTransition`](/reference/react/useTransition) vam omogućava da označite promenu state-a kao neblokirajuću i dozvolite da je druga ažuriranja prekinu.
105
+
- [`useDeferredValue`](/reference/react/useDeferredValue) vam omogućava da odložite ažuriranje nekritičnih delova UI-a i prvo pustite ažuriranje ostalih delova.
106
106
107
107
---
108
108
109
-
## Other Hooks {/*other-hooks*/}
109
+
## Ostali Hook-ovi {/*other-hooks*/}
110
110
111
-
These Hooks are mostly useful to library authors and aren't commonly used in the application code.
111
+
Ovi Hook-ovi su uglavnom korisni za autore biblioteka i ne koriste se često u kodu aplikacije.
112
112
113
-
- [`useDebugValue`](/reference/react/useDebugValue) lets you customize the label React DevTools displays for your custom Hook.
114
-
- [`useId`](/reference/react/useId) lets a component associate a unique ID with itself. Typically used with accessibility APIs.
115
-
- [`useSyncExternalStore`](/reference/react/useSyncExternalStore) lets a component subscribe to an external store.
116
-
* [`useActionState`](/reference/react/useActionState) allows you to manage state of actions.
113
+
- [`useDebugValue`](/reference/react/useDebugValue) vam omogućava da prilagodite labelu koju React DevTools prikazuje za vaš prilagođeni Hook.
114
+
- [`useId`](/reference/react/useId) omogućava komponenti da sebi asocira jedinstveni ID. Tipično se koristi u API-jima za pristupačnost.
115
+
- [`useSyncExternalStore`](/reference/react/useSyncExternalStore) omogućava komponenti da se pretplati na eksterno skladište.
116
+
* [`useActionState`](/reference/react/useActionState) vam omogućava da upravljate state-om akcija.
117
117
118
118
---
119
119
120
-
## Your own Hooks {/*your-own-hooks*/}
120
+
## Vaši Hook-ovi {/*your-own-hooks*/}
121
121
122
-
You can also [define your own custom Hooks](/learn/reusing-logic-with-custom-hooks#extracting-your-own-custom-hook-from-a-component) as JavaScript functions.
122
+
Možete da [definišete vaše prilagođene Hook-ove](/learn/reusing-logic-with-custom-hooks#extracting-your-own-custom-hook-from-a-component) kao JavaScript funkcije.
0 commit comments