React.render vs ReactDOM.render – which one should be used?

Question: I see some React tutorials using React.render and some using ReactDOM.render. Which one should be used?

React introduced react-dom package in version 0.14 which has ReactDOM.render. It is better to use ReactDOM for new code. Here is sample usage.

// include react.js and react-dom.js
<script type="text/babel">
ReactDOM.render(
  <h1>Hello world</h1>,
  document.getElementById('hello')
);
</script>

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments