A
A
Alexey Sosnovsky2016-04-21 13:45:54
React
Alexey Sosnovsky, 2016-04-21 13:45:54

How to apply a tag in React so that there is no error in the console?

there is a layout code

export default React.createClass({
  render() {
    return <html>
    <head>
      <title>{this.props.title}</title>
    </head>
    <body>
       {this.props.children}
       <script src="bundle.js"></script>
    </body>
    </html>;
  }
});

which is given during server rendering
res.render(
        'index',
        {
          name: 'John'
        },
        (err, html) =>res.send(html)
      );

Everything seems to be simple, but it gives an error:
Uncaught Invariant Violation: _registerComponent(...): Target container is not a DOM element.

and like the tag appears in the page markup.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
KnightForce, 2017-05-15
@KnightForce

Need to be more precise.
More complete code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question