Uncaught error:_registerComponent(…): target container is not DOM element
<script type="text/babel">
var SessionPage = React.createClass({
getInitialState: function () {
var context = {
context: {}
};
return context;
},
componentDidMount: function () {
this.serverRequest = $.ajax({
url: this.props.url,
data: {},
type: 'GET',
dataType: 'json',
success: function (data) {
this.setState({
context: data
})
}.bind(this), // If you don't bind it, the this inside the method is $.ajax({this object}), and the bind incoming this should be the component. You can console the output and see.
error: function (msg) {
console.log("error:" + msg);
}.bind(this)
})
},
componentWillUnmount: function () {
this.serverRequest.abort()
},
render: function () {
var creatItem = function (it) {
return (<code>JSON.stringify(it)</code>)
};
return (
<div>{creatItem(this.state.context)}</div>
);
}
});
ReactDOM.render(<SessionPage url="/api/session"/>);
</script>
It’s just a problem of not finding DOM nodes.
To:
ReactDOM.render(< SessionPage url=”/api/session”/> , document.getElementById(“App”));
Read More:
- Error: Target container is not a DOM element.
- When docker starts tomcat, the access port of the container displays 404, and the source server fails to find the representation of the target resource or is unwilling to disclose an existing one
- Wrong classification of Python — assertion cur_ Target is greater than or equal to 0 and cur_ Target is less than n_ classes failed
- Python learning notes (5) — cross entropy error runtimeerror: 1D target tensor expected, multi target not supported
- Common error: uncaught typeerror: document.getElementsByClassName (…).addEventListener is not a function
- [Solved] jQuery Error: Uncaught TypeError: this.attr is not a function
- The echots in Vue reports an error. After obtaining the DOM element, the chart can be displayed. The console still reports an error
- Failed to execute ‘getComputedStyle’ on ‘Window’: parameter 1 is not of type ‘Element’.
- Uncaught ReferenceError: FileAsyncWriter is not defined
- Uncaught TypeError: Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node How to Fix
- [Solved] Echarts Error: There is a chart instance already initialized on the dom!
- The key “target densitydpi” is not supported
- error: initializer element is not constant [How to Solve]
- Selenium reports an error and solves the problem of element not interactive exception, element not interactive
- [Error][IntelliJ IDEA] Element XXX is not allowed here
- Get connection timeout retry: 1 MySQL errorcode 0, state 08s01 docker container accessing MySQL container is very slow and sometimes interrupted
- Element ‘dependency‘ cannot have character [children], because the type‘s content type is element-on
- The docker copies the win10 host file into the docker container. An error is reported: copying between containers is not supported
- Error: path not specified when the docker 1.7 file is uploaded to the container in CentOS
- Uncaught TypeError: Failed to execute ‘removeChild’ on ‘Node’: parameter 1 is not of type ‘Node’.