LoginSignup
3
3

More than 5 years have passed since last update.

Reactのアップグレードの注意

Posted at

客0.13.xバージョンに比べて、客新いReactバージョンはたくさん変更するところがあります。アップグレードの時、注意してください。改善ところはReactを使っているシステムを安定になって、パフォーマンスも高くなります。

1. 変更するところ

Render方法を変更する。
古い:

var React = require('react');
React.render(<App />, node);

新しい:

var ReactDOM = require('react-dom');
ReactDOM.render(<App />, node);

Nodeを検査する:
古い:

React.findDOMNode();

新しい:

ReactDOM.findDOMNode();

Nodeの中にNodeを検査する:

古い:

this.getDOMNode();

新しい:

ReactDOM.findDOMNode(this);

2. 改善ところ

nullバリューがない。
例:

this.functioin.bind(null)
return(
<p>{text}<p>)

Render方法の中に、InlineCssのルールを守る。
例:

margin:0 (X)
margin:0px(O)

HTMLのルールを守る。

<table>
<td></td>
</table>(X)

<table>
<tbody><td></td></tbody>
</table>(0)
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3