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
Copy file name to clipboardExpand all lines: src/content/learn/state-as-a-snapshot.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,11 +17,11 @@ Zmienne stanu mogą wyglądać jak zwykłe zmienne javascriptowe, które można
17
17
18
18
</YouWillLearn>
19
19
20
-
## Setting state triggers renders {/*setting-state-triggers-renders*/}
20
+
## Ustawianie stanu wyzwala ponowne renderowanie {/*setting-state-triggers-renders*/}
21
21
22
-
You might think of your user interface as changing directly in response to the user event like a click. In React, it works a little differently from this mental model. On the previous page, you saw that [setting state requests a re-render](/learn/render-and-commit#step-1-trigger-a-render)from React. This means that for an interface to react to the event, you need to *update the state*.
22
+
Możesz myśleć, że twój interfejs użytkownika zmienia się bezpośrednio w odpowiedzi na zdarzenie użytkownika, takie jak kliknięcie. W Reakcie działa to nieco inaczej. Na poprzedniej stronie zobaczyłeś, że [ustawienie stanu wysyła żądanie ponownego renderowania](/learn/render-and-commit#step-1-trigger-a-render)do Reacta. Oznacza to, że aby interfejs zareagował na zdarzenie, musisz *zaktualizować stan*.
23
23
24
-
In this example, when you press "send", `setIsSent(true)`tells React to re-render the UI:
24
+
W tym przykładzie, gdy naciśniesz "Wyślij", wywołanie `setIsSent(true)`informuje Reacta, aby ponownie wyrenderował interfejs użytkownika:
25
25
26
26
<Sandpack>
27
27
@@ -30,9 +30,9 @@ import { useState } from 'react';
30
30
31
31
exportdefaultfunctionForm() {
32
32
const [isSent, setIsSent] =useState(false);
33
-
const [message, setMessage] =useState('Hi!');
33
+
const [message, setMessage] =useState('Cześć!');
34
34
if (isSent) {
35
-
return<h1>Your message is on its way!</h1>
35
+
return<h1>Twoja wiadomość jest w drodze!</h1>
36
36
}
37
37
return (
38
38
<form onSubmit={(e) => {
@@ -41,11 +41,11 @@ export default function Form() {
0 commit comments