Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any difference between React.render() and ReactDOM.render()?

Tags:

reactjs

I have noticed that some of the places in articles they have used React.render() and some of the places ReactDOM.render(). Is there any specific difference between these two?

like image 482
Suresh Ponnukalai Avatar asked Oct 08 '15 05:10

Suresh Ponnukalai


People also ask

What is the difference between ReactDOM render and render?

ReactDOM. render renders your components to the DOM while a component's render returns the elements that make up the component.

What is the difference between ReactDOM and React?

React library is responsible for creating views and ReactDOM library is responsible to actually render UI in the browser. Include these two libraries before your main JavaScript file. While learning How React works, we'll build a small application using react and ReactDOM.

What does ReactDOM render () do?

The ReactDOM.render() function takes two arguments, HTML code and an HTML element. The purpose of the function is to display the specified HTML code inside the specified HTML element.

Is ReactDOM render necessary?

The render() function is one of the most useful and important functions of ReactDOM. it returns a reference to the component after rendering a React element into the DOM in the provided container (or returns null for stateless components).


1 Answers

This is a very recent change introduced with 0.14. They split up React into a core library and the DOM adapter. Rendering is now done via ReactDOM.render.

https://facebook.github.io/react/blog/2015/10/07/react-v0.14.html

like image 179
kraf Avatar answered Oct 01 '22 21:10

kraf