解释 mobx 控制台输出
Interprete mobx console outputs
我无法解释 mobx 控制台输出。所有组件在控制台输出中都被命名为“observerComponent”。
有没有办法强制使用名称?
控制台输出:
react_devtools_backend.js:3973 Warning: Cannot update a component (`observerComponent`) while rendering a different component (`observerComponent`).
at observerComponent (http://localhost:4200/vendor.js:40885:73)
at div
at http://localhost:4200/vendor.js:12601:62
at div
at http://localhost:4200/vendor.js:12763:34
at observerComponent (http://localhost:4200/vendor.js:40885:73)
at DndProvider (http://localhost:4200/vendor.js:135424:11)
at observerComponent (http://localhost:4200/vendor.js:40885:73)
at observerComponent (http://localhost:4200/vendor.js:40885:73)
at Route (http://localhost:4200/vendor.js:107737:29)
at Switch (http://localhost:4200/vendor.js:107939:29)
at main
at http://localhost:4200/vendor.js:14246:25
at http://localhost:4200/vendor.js:14229:66
at section
at http://localhost:4200/vendor.js:14262:63
at http://localhost:4200/vendor.js:14229:66
at section
at http://localhost:4200/vendor.js:14262:63
at http://localhost:4200/vendor.js:14229:66
at observerComponent (http://localhost:4200/vendor.js:40885:73)
at App (http://localhost:4200/main.js:277:76)
at Router (http://localhost:4200/vendor.js:107368:30)
at BrowserRouter (http://localhost:4200/vendor.js:106988:35)
组件:
const GenericEditor = observer(() => {
/**/
});
export default GenericEditor;
//编辑
https://mobx.js.org/react-integration.html#displayname
不适用于 react
的控制台输出
您可以尝试使用 displayName
export const MyComponent = observer(function MyComponent(props) {
return <div>hi</div>
})
MyComponent.displayName = 'MyComponent'
我无法解释 mobx 控制台输出。所有组件在控制台输出中都被命名为“observerComponent”。 有没有办法强制使用名称?
控制台输出:
react_devtools_backend.js:3973 Warning: Cannot update a component (`observerComponent`) while rendering a different component (`observerComponent`).
at observerComponent (http://localhost:4200/vendor.js:40885:73)
at div
at http://localhost:4200/vendor.js:12601:62
at div
at http://localhost:4200/vendor.js:12763:34
at observerComponent (http://localhost:4200/vendor.js:40885:73)
at DndProvider (http://localhost:4200/vendor.js:135424:11)
at observerComponent (http://localhost:4200/vendor.js:40885:73)
at observerComponent (http://localhost:4200/vendor.js:40885:73)
at Route (http://localhost:4200/vendor.js:107737:29)
at Switch (http://localhost:4200/vendor.js:107939:29)
at main
at http://localhost:4200/vendor.js:14246:25
at http://localhost:4200/vendor.js:14229:66
at section
at http://localhost:4200/vendor.js:14262:63
at http://localhost:4200/vendor.js:14229:66
at section
at http://localhost:4200/vendor.js:14262:63
at http://localhost:4200/vendor.js:14229:66
at observerComponent (http://localhost:4200/vendor.js:40885:73)
at App (http://localhost:4200/main.js:277:76)
at Router (http://localhost:4200/vendor.js:107368:30)
at BrowserRouter (http://localhost:4200/vendor.js:106988:35)
组件:
const GenericEditor = observer(() => {
/**/
});
export default GenericEditor;
//编辑
https://mobx.js.org/react-integration.html#displayname 不适用于 react
的控制台输出您可以尝试使用 displayName
export const MyComponent = observer(function MyComponent(props) {
return <div>hi</div>
})
MyComponent.displayName = 'MyComponent'