So I thing this is happening because of the conditional rendering and state change. Here is my rendering:
!isOn
?
{...}
:
<CountDown
until={2}
onFinish={onFinish}
digitStyle={styles.timerContainer}
digitTxtStyle={styles.timerTextSize}
timeToShow={mins >= 60 ? ["H", "M", "S"] : ["M", "S"]}
timeLabels={{}}
separatorStyle={styles.timerTextSize}
showSeparator
/>
Here is my onFinished method:
const onFinish = () => {
setTimeHook({
...timeHook,
isOn: 0,
});
};
And the state:
const time = {
mins: 5,
isOn: 0,
};
const [timeHook, setTimeHook] = useState(time);
I'm also not familiar about what does even mean this error, so any info would be great. Though the code works well, I'm afraid of memory leak. So how can I fix that problem?
question from:
https://stackoverflow.com/questions/65942839/getting-this-error-while-my-timer-is-ending-cant-perform-a-react-state-update 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…