Attempted to update component Index
that has already been unmounted (or failed to mount).
尝试更新已卸载(或无法挂载)的组件Index
。
错误示例一:
错误代码:❌
@inject('CrumbStore')
constructor(props) {
super(props);
this.CrumbStore.addCrumb({ // this 改成 props ✅
path: '/',
breadcrumbName: '各大会场列表'
});
}
错误示例二:
错误代码:❌
@inject('CrumbStore')
constructor(props) {
super(props);
const title = props.match.param.id && '会场编辑'; // param 改成 params ✅
}
错误示例三:
错误代码:❌
// 未引入CrumbStore @inject('CrumbStore') ✅
constructor(props) {
super(props);
props.CrumbStore.setCurCrumb(
{ title: '测试' }
);
}
警告 :Added synchronous DOM mutation listener to a event. Consider using MutationObserver to make the page more responsive.
为事件添加了同步DOM突变侦听器。 考虑使用MutationObserver使页面更具响应性。
错误代码:❌
@inject('CrumbStore')
// 添加 @observer 监听组件 ✅
class Layout extends React.Component {
// ...
}