Created
June 3, 2022 08:56
-
-
Save oney/a7c9b6c5f953e97faabbe3f6437b8e4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Note() { | |
const [text, setText] = useState(''); | |
const onTick = useEvent(() => { | |
count += 1; // 😩 I can't modify 'count' | |
saveDraft(text, count); | |
}); | |
useEffect(() => { | |
let count = 0; | |
const id = setInterval(onTick, 1000); | |
return () => clearInterval(id); | |
}, []); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment