Reputation: 865
I am just trying to print the data test foo using react. In my app.js file i have written the following code
/** @jsx React.DOM */
(function(){
'use strict';
var Quiz = React.createClass({
render:function(){
return <div> test {this.props.data}</div>;
}
}); // react class Quiz
ReactDOM.render( <Quiz data={"foo"} />, document.getElementbyID('#baseNode') );
})();
but in place of document.getElementById('baseNode') if i use $('#baseNode') it throws me an error react.js:18307 Uncaught Error: Invariant Violation: _registerComponent(...): Target container is not a DOM element.
I have an div with id baseNode in my html Page
Upvotes: 1
Views: 638
Reputation: 77482
$('#baseNode')
returns jQuery
Object, but second argument should be HTMLElement
., $('#baseNode')[0]
is equivalent to document.getElementById( 'baseNode')
ReactDOM.render(
<Quiz data={"foo"} />,
$('#baseNode')[0]
);
Upvotes: 2