Skip to content

Commit b2369bd

Browse files
LucaBlackDragondeblasis
authored andcommitted
Translation for the page 'React.Component' (#118)
* Inizio traduzione pagina React.Component * Continuo traduzione (fino ai metodi più utilizzati) * Continuo traduzione (fino all'inizio dei metodi non comuni del lifecycle) * Completata traduzione metodi non comuni * Terminata traduzione metodi del lifecycle obsoleti * Traduzione completata! * Correzioni * Apply suggestions from code review Too many typos!!! XD Co-Authored-By: LucaBlackDragon <[email protected]> * Fix broken build
1 parent 088cf8c commit b2369bd

9 files changed

+243
-232
lines changed

GLOSSARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Suggestion on words and terms:
3434
| React component class | classe componente React |
3535
| React component type | tipo componente React |
3636
| function component | componente funzione |
37+
| error boundary | contenitore di errori |
3738

3839
## Problematic terms
3940

content/docs/code-splitting.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ function MyComponent() {
189189
}
190190
```
191191

192-
### Error boundaries {#error-boundaries}
192+
### Contenitori di Errori {#error-boundaries}
193193

194-
If the other module fails to load (for example, due to network failure), it will trigger an error. You can handle these errors to show a nice user experience and manage recovery with [Error Boundaries](/docs/error-boundaries.html). Once you've created your Error Boundary, you can use it anywhere above your lazy components to display an error state when there's a network error.
194+
If the other module fails to load (for example, due to network failure), it will trigger an error. You can handle these errors to show a nice user experience and manage recovery with [Contenitori di Errori](/docs/error-boundaries.html). Once you've created your Contenitore di Errori, you can use it anywhere above your lazy components to display an error state when there's a network error.
195195

196196
```js
197197
import MyErrorBoundary from './MyErrorBoundary';

content/docs/codebase-overview.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Its main goals are:
209209
* Ability to prioritize, rebase and reuse work in progress.
210210
* Ability to yield back and forth between parents and children to support layout in React.
211211
* Ability to return multiple elements from `render()`.
212-
* Better support for error boundaries.
212+
* Migliore supporto per i contenitori di errori.
213213

214214
You can read more about React Fiber Architecture [here](https://github.com/acdlite/react-fiber-architecture) and [here](https://medium.com/react-in-depth/inside-fiber-in-depth-overview-of-the-new-reconciliation-algorithm-in-react-e1c04700ef6e). While it has shipped with React 16, the async features are not enabled by default yet.
215215

content/docs/error-boundaries.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: error-boundaries
3-
title: Error Boundaries
3+
title: Contenitori di Errori
44
permalink: docs/error-boundaries.html
55
---
66

content/docs/nav.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
- id: context
4545
title: Context
4646
- id: error-boundaries
47-
title: Error Boundaries
47+
title: Contenitori di Errori
4848
- id: forwarding-refs
4949
title: Forwarding Refs
5050
- id: fragments

content/docs/react-without-es6.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: react-without-es6
3-
title: React Without ES6
3+
title: React senza ES6
44
permalink: docs/react-without-es6.html
55
---
66

content/docs/reference-react-component.md

+210-210
Large diffs are not rendered by default.

content/docs/reference-react.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ React components let you split the UI into independent, reusable pieces, and thi
2424
- [`React.Component`](#reactcomponent)
2525
- [`React.PureComponent`](#reactpurecomponent)
2626

27-
If you don't use ES6 classes, you may use the `create-react-class` module instead. See [Using React without ES6](/docs/react-without-es6.html) for more information.
27+
If you don't use ES6 classes, you may use the `create-react-class` module instead. See [React senza ES6](/docs/react-without-es6.html) for more information.
2828

2929
React components can also be defined as functions which can be wrapped:
3030

Original file line numberDiff line numberDiff line change
@@ -1,32 +1,42 @@
1-
class ScrollingList extends React.Component {
1+
class ListaScorrimento extends React.Component {
22
constructor(props) {
33
super(props);
4-
this.listRef = React.createRef();
4+
this.rifLista = React.createRef();
55
}
66

7-
getSnapshotBeforeUpdate(prevProps, prevState) {
8-
// Are we adding new items to the list?
9-
// Capture the scroll position so we can adjust scroll later.
10-
if (prevProps.list.length < this.props.list.length) {
11-
const list = this.listRef.current;
12-
return list.scrollHeight - list.scrollTop;
7+
getSnapshotBeforeUpdate(
8+
propsPrecedenti,
9+
statePrecedente
10+
) {
11+
// Stiamo aggiungendo nuovi elementi alla lista?
12+
// Salviamo la posizione dello scroll in modo da poterla aggiustare in seguito.
13+
if (
14+
propsPrecedenti.list.length < this.props.list.length
15+
) {
16+
const lista = this.rifLista.current;
17+
return lista.scrollHeight - lista.scrollTop;
1318
}
1419
return null;
1520
}
1621

17-
componentDidUpdate(prevProps, prevState, snapshot) {
18-
// If we have a snapshot value, we've just added new items.
19-
// Adjust scroll so these new items don't push the old ones out of view.
20-
// (snapshot here is the value returned from getSnapshotBeforeUpdate)
22+
componentDidUpdate(
23+
propsPrecedenti,
24+
statePrecedente,
25+
snapshot
26+
) {
27+
// Se snapshot è definito, abbiamo appenan aggiunto nuovi elementi alla lista.
28+
// Aggiustiamo lo scroll in modo che i nuovi elementi non spingano quelli
29+
// preesistenti fuori dallo schermo.
30+
// (snapshot contiene il valore restituito da getSnapshotBeforeUpdate)
2131
if (snapshot !== null) {
22-
const list = this.listRef.current;
23-
list.scrollTop = list.scrollHeight - snapshot;
32+
const lista = this.rifLista.current;
33+
lista.scrollTop = lista.scrollHeight - snapshot;
2434
}
2535
}
2636

2737
render() {
2838
return (
29-
<div ref={this.listRef}>{/* ...contents... */}</div>
39+
<div ref={this.rifLista}>{/* ...contenuti... */}</div>
3040
);
3141
}
3242
}

0 commit comments

Comments
 (0)