Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate 10.8-pure-render-mixin.md to Japanese #4495

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/docs/10.8-pure-render-mixin.ja-JP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
id: pure-render-mixin
title: PureRenderMixin
permalink: pure-render-mixin-ja-JP.html
prev: update-ja-JP.html
next: perf-ja-JP.html
---

Reactコンポーネントのrender関数が「ピュア」である(言い換えると、同じpropsやstateが与えられた時に同じ結果をレンダリングする)場合は、いくつかのケースでパフォーマンスをあげるためにこのミックスインを使用することができます。

例:

```js
var PureRenderMixin = require('react/addons').addons.PureRenderMixin;
React.createClass({
mixins: [PureRenderMixin],

render: function() {
return <div className={this.props.className}>foo</div>;
}
});
```

内部で、このミックスインは[shouldComponentUpdate](/react/docs/component-specs-ja-JP.html#updating-shouldcomponentupdate)を実行します。現在のpropsとstateを次のものと比較し、同様のものであれば、 `false` を返します。

> 注意:
> このミックスインはオブジェクトの比較のみを行います。それらが複雑なデータ構造を持っていた場合、深い位置における違いは見逃されることがあります。単純なpropsやstateをコンポーネントが持っている場合にのみ、使用してください。深いデータ構造が変更されることが分かっている場合は、 `forceUpdate()` を使用してください。または、ネストされたデータの比較を速く行うために[不変オブジェクト](https://facebook.github.io/immutable-js/)の使用を考えてみてください。
> 更に、 `shouldComponentUpdate` は全てのコンポーネントのサブツリーのアップデートをスキップします。全ての子要素のコンポーネントもまた、「ピュア」であることを確認してください。