I\'m learning ReactJs and really like it. I wanted to ask if we can render virtual DOM to document by class name.
React.render(
It seems you have used a wrong method.
Probably you should use getElementsByClassName
instead of getElementByClassName
. And DO NOT forget getElementsByClassName
returns an array-like obj HTMLCollection, so picking the first element is necessary.
React.render(
<CommentBox url="data/comments.json" pollInterval={2000} />,
document.getElementsByClassName('className')[0]
);
For more infomation, check out the docs.