@@ -50,9 +50,9 @@ class MyComponent extends React.Component {
50
50
items: result .items
51
51
});
52
52
},
53
- // Nota: è importante gestire gli errori qui
54
- // invece di un blocco catch() in modo da non fare passare
55
- // eccezioni da bug reali nei componenti .
53
+ // Note: it's important to handle errors here
54
+ // instead of a catch() block so that we don't swallow
55
+ // exceptions from actual bugs in components .
56
56
(error ) => {
57
57
this .setState ({
58
58
isLoaded: true ,
@@ -92,9 +92,9 @@ function MyComponent() {
92
92
const [items , setItems ] = useState ([]);
93
93
94
94
95
- // Nota: l'array deps vuoto [] significa
96
- // questo useEffect verrà eseguito una volta
97
- // simile a componentDidMount()
95
+ // Note: the empty deps array [] means
96
+ // this useEffect will run once
97
+ // similar to componentDidMount()
98
98
useEffect (() => {
99
99
fetch (" https://api.example.com/items" )
100
100
.then (res => res .json ())
@@ -103,9 +103,9 @@ function MyComponent() {
103
103
setIsLoaded (true );
104
104
setItems (result);
105
105
},
106
- // Nota: è importante gestire gli errori qui
107
- // invece di un blocco catch() in modo da non fare passare
108
- // eccezioni da bug reali nei componenti .
106
+ // Note: it's important to handle errors here
107
+ // instead of a catch() block so that we don't swallow
108
+ // exceptions from actual bugs in components .
109
109
(error ) => {
110
110
setIsLoaded (true );
111
111
setError (error);
0 commit comments