'antd Can't perform a React state update on an unmounted component
I use antd pro useModel. (https://pro.ant.design/docs/simple-model)
ex.
useEffect(() => {
const intervalId = setInterval(() => {
fetchControlData();
}, 1000)
return () => {
clearControl();
clearInterval(intervalId);
}
}, [])
fetchControlData and clearControl is useModel's function.
fetchControlData() do request and state update. clearControl() do state clear (default value init)
all useModel use cleanUp (clearInterval and clear model's state.
but devScripts.js:6523 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
error is occured. even if all useEffect and useModel' function not used, error is occured (only useModel (tate value, state function) model Declaration)
How I resolve this error?
this memory leak error log only onetime appeared. Is this error not fatal?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
