[英]Facebook React: Uncaught Error: Invariant Violation: getDOMNode(): A component must be mounted to have a DOM node
I have the following error within reactjs internals: 我在reactjs内部有以下错误:
Uncaught Error: Invariant Violation: getDOMNode(): A component must be mounted to have a DOM node 未捕获的错误:始终违反:getDOMNode():必须安装组件才能具有DOM节点
What does it mean? 这是什么意思? What can I do about it? 我该怎么办?
the stack trace: 堆栈跟踪:
invariantDev react.js:14392
ReactComponentBrowserEnvironment.Mixin.getDOMNode react.js:4072
React.createClass.scrollToBottom app.js:14124
(anonymous function)
This means that you're using getDOMNode before the component has been rendered in the DOM. 这意味着在DOM中呈现组件之前,您正在使用getDOMNode 。
You can use componentDidMount to wait to run code until the component has been mounted: 您可以使用componentDidMount等待运行代码,直到挂载组件为止:
componentDidMount() {
// do stuff here that requires the DOM to exist
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.