Skip to content

Commit 6fe7caf

Browse files
committed
translate content/docs/addons-shallow-compare.md
1 parent 89da8d2 commit 6fe7caf

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

content/docs/addons-shallow-compare.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ category: Reference
88

99
> Note:
1010
>
11-
> `shallowCompare` is a legacy add-on. Use [`React.PureComponent`](/docs/react-api.html#reactpurecomponent) instead.
11+
> `shallowCompare` устарел. Используйте вместо этого [`React.PureComponent`](/docs/react-api.html#reactpurecomponent).
1212
13-
**Importing**
13+
**Импортирование**
1414

1515
```javascript
1616
import shallowCompare from 'react-addons-shallow-compare'; // ES6
1717
var shallowCompare = require('react-addons-shallow-compare'); // ES5 with npm
1818
```
1919

20-
## Overview {#overview}
20+
## Обзор {#overview}
2121

22-
Before [`React.PureComponent`](/docs/react-api.html#reactpurecomponent) was introduced, `shallowCompare` was commonly used to achieve the same functionality as [`PureRenderMixin`](pure-render-mixin.html) while using ES6 classes with React.
22+
Перед появленияем [`React.PureComponent`](/docs/react-api.html#reactpurecomponent) `shallowCompare` использовался для того же, что и [`PureRenderMixin`](pure-render-mixin.html) при использовании ES6-классов с React.
2323

24-
If your React component's render function is "pure" (in other words, it renders the same result given the same props and state), you can use this helper function for a performance boost in some cases.
24+
Если функция рендера компонента React является "чистой" (возвращается тот же результат при таких же пропсах и состоянии), вы можете в некоторых случаях использовать эту функцию для повышения производительности.
2525

26-
Example:
26+
Пример:
2727

2828
```js
2929
export class SampleComponent extends React.Component {
@@ -32,13 +32,13 @@ export class SampleComponent extends React.Component {
3232
}
3333

3434
render() {
35-
return <div className={this.props.className}>foo</div>;
35+
return <div className={this.props.className}>тест</div>;
3636
}
3737
}
3838
```
3939

40-
`shallowCompare` performs a shallow equality check on the current `props` and `nextProps` objects as well as the current `state` and `nextState` objects.
41-
It does this by iterating on the keys of the objects being compared and returning true when the values of a key in each object are not strictly equal.
40+
`shallowCompare` поверхностно сравнивает объекты текущих `props` и `state` с будущими `nextProps` и `nextState`.
41+
При переборе ключей сравниваемых объектов возвращается `true`, если значения ключа в каждом объекте имеют нестрогое равенство.
4242

43-
`shallowCompare` returns `true` if the shallow comparison for props or state fails and therefore the component should update.
44-
`shallowCompare` returns `false` if the shallow comparison for props and state both pass and therefore the component does not need to update.
43+
`shallowCompare` возвращает `true` если поверхностное сравнение для пропсов или состояния находит разницу. В таком случае компонент обновится.
44+
`shallowCompare` возвращает `false` если поверхностное сравнении для пропсов и состояния не находит разницу. Компонент не нуждается в обновлении.

0 commit comments

Comments
 (0)