Skip to content

Commit ec1e576

Browse files
committed
nexttick4
1 parent cec3550 commit ec1e576

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/content/learn/tutorial-tic-tac-toe.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ function Square({ value, onSquareClick }) {
10941094
}
10951095
```
10961096
1097-
Now you'll connect the `onSquareClick` prop to a function in the `Board` component that you'll name `handleClick`. To connect `onSquareClick` to `handleClick` you'll pass a function to the `onSquareClick` prop of the first `Square` component:
1097+
Sada ćete povezati `onSquareClick` prop sa funkcijom u `Board` komponenti koju ćete nazvati `handleClick`. Da biste povezali `onSquareClick` sa `handleClick`, prosledićete funkciju kao vrednost `onSquareClick` prop-u prve `Square` komponente:
10981098
10991099
```js {7}
11001100
export default function Board() {
@@ -1109,7 +1109,7 @@ export default function Board() {
11091109
}
11101110
```
11111111
1112-
Lastly, you will define the `handleClick` function inside the Board component to update the `squares` array holding your board's state:
1112+
Na kraju, definisaćete funkciju `handleClick` unutar `Board` komponente kako biste update-ovali niz `squares` koji čuva state vaše table:
11131113
11141114
```js {4-8}
11151115
export default function Board() {
@@ -1127,17 +1127,17 @@ export default function Board() {
11271127
}
11281128
```
11291129
1130-
The `handleClick` function creates a copy of the `squares` array (`nextSquares`) with the JavaScript `slice()` Array method. Then, `handleClick` updates the `nextSquares` array to add `X` to the first (`[0]` index) square.
1130+
Funkcija `handleClick` kreira kopiju niza `squares` (`nextSquares`) korišćenjem JavaScript metode `slice()` za nizove. Zatim, `handleClick` ažurira niz `nextSquares` tako što dodaje `X` na prvi kvadrat (indeks `[0]`).
11311131
1132-
Calling the `setSquares` function lets React know the state of the component has changed. This will trigger a re-render of the components that use the `squares` state (`Board`) as well as its child components (the `Square` components that make up the board).
1132+
Pozivanjem funkcije `setSquares` obaveštavate React da se state komponente promenio. Ovo će pokrenuti ponovno renderovanje komponenti koje koriste state `squares` (`Board`), kao i njenih child komponenti (`Square` komponente koje čine tablu).
11331133
11341134
<Note>
11351135
1136-
JavaScript supports [closures](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures) which means an inner function (e.g. `handleClick`) has access to variables and functions defined in an outer function (e.g. `Board`). The `handleClick` function can read the `squares` state and call the `setSquares` method because they are both defined inside of the `Board` function.
1136+
JavaScript podržava [closures](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures), što znači da unutrašnja funkcija (npr. `handleClick`) ima pristup varijablama i funkcijama definisanim u spoljašnjoj funkciji (npr. `Board`). Funkcija `handleClick` može da čita state `squares` i poziva metodu `setSquares` jer su obe definisane unutar funkcije `Board`.
11371137
11381138
</Note>
11391139
1140-
Now you can add X's to the board... but only to the upper left square. Your `handleClick` function is hardcoded to update the index for the upper left square (`0`). Let's update `handleClick` to be able to update any square. Add an argument `i` to the `handleClick` function that takes the index of the square to update:
1140+
Sada možete dodati X-ove na tablu... ali samo u gornji levi kvadrat. Vaša funkcija `handleClick` je trenutno hardkodirana da ažurira indeks gornjeg levog kvadrata (`0`). Hajde da ažuriramo `handleClick` tako da može ažurirati bilo koji kvadrat. Dodajte argument `i` funkciji `handleClick` koji prima indeks kvadrata koji treba ažurirati:
11411141
11421142
```js {4,6}
11431143
export default function Board() {

0 commit comments

Comments
 (0)