React + Backbone, Target Container Is Not A Dom Element
Note: This is a react error being thrown. So I am trying an experiment where I render a post component from a backbone router based on that page. Now I know you would not typically
Solution 1:
You're setting this.mountNode
to $('#blog-manage')
, which is a jQuery object (essentially an array of nodes). If you instead do
mountNode: $('#blog-manage')[0]
or
mountNode: $('#blog-manage').get(0)
then you'll have reference to the actual DOM node.
Solution 2:
React.renderComponent
renders a component into a real DOM element. The exception is being thrown because you aren't passing a DOM element as the required second argument.
ReactComponent renderComponent( ReactComponent component, DOMElement container, [function callback] )
Render a React component into the DOM in the supplied container and return a reference to the component.
If you just want the HTML from React, you can use React.renderComponentToStaticMarkup
instead.
Post a Comment for "React + Backbone, Target Container Is Not A Dom Element"