React render() Method
The render() method format is as follows:
ReactDOM.render(element, container[, callback])
The render() method is used to render a React element into the container provided by the container parameter.
The render() method returns a reference to the component (or null for stateless components).
If the React element has been previously rendered into the container, this will perform an update on it and change the DOM only when necessary to reflect the latest React element.
If the optional callback function is provided, it will be executed after the component is rendered or updated.
The following example uses the render() method to render the React element Header
into a container with id="root":
Example
class Header extends React.Component {
render() {
return (
<h1>tutorialpro.org - Learning is not only about technology, it's about dreams!</h1>
);
}
}
ReactDOM.render(<Header />, document.getElementById('root'));