react是不是不能把已经render过的组件件再一次render到同一个dom上?


遇到一个问题:


 先渲染自定义的一个组件
React.render(<IndexComponent />, document.body);
后用户操作要更改整个界面布局所以再进行一次渲染
React.render(<UserComponent />, document.body);
待用户操作完成之后,又需要回到之前的界面布局去,这时候使用渲染整个界面
React.render(<IndexComponent />, document.body);



 这时候报错了
报错信息:
type.toUpperCase is not a function
报错信息
function autoGenerateWrapperClass(type) {
  return ReactClass.createClass({
    tagName: type.toUpperCase(),
    render: function render() {
      return new ReactElement(type, null, null, null, null, this.props);
    }
  });
}

不是很明白这里面的意思。是不是react里面不能把已经render过的组件再一次render到同一个dom上?

react.js

OpenVL 9 years, 11 months ago

Your Answer