Hello,
I want to use the native cleanup (unmount) function from react. Sadly Typescript is throwing an error that a return value of useEffect is not valid.
Here are the doc from the react:
My Test Code:
useEffect(() => {
let timeout: Timeout;
if (saved) {
timeout = setTimeout(() => setSaved(false), 5000);
}
return () => {
clearTimeout(timeout);
}
}, [saved]);
TS2345: Argument of type ‘() => () => void’ is not assignable to parameter of type ‘() => void | Promise’. Type ‘() => void’ is not assignable to type ‘void | Promise’. Type ‘() => void’ is missing the following properties from type ‘Promise’: then, catch, finally, [Symbol.toStringTag]
How can I solve it with Forge UI?