I am newbie in reactjs and confuses on use of render function inside component class and using with ReactDOM global object.
Answers to this question don't fully addressed the use of render()
function inside the class component. Here in reactjs official site, I found functional component which doesn't make use of render method. So my point is what the role render()
function played when creating component [as shown in the below example].
I am following this tutorial. I think using render with ReactDOM creates virtual Dom but what the use of it inside all the component class. On the official tutorial from react render()
is used on all component class.
class Square extends React.Component {
render() {
return(
<button className="Square">
{this.props.value}
</button>
);
}
}
ReactDOM.render(
<Game />,
document.getElementById('root')
);