Here's an autosave button that lies to the user: function Editor ({ docId }: { docId : string }) { const [ text , setText ] = useState ( "" ); const [ status , setStatus ] = useState < " idle " | " saving " | " saved " | " dirty " > ( " idle " ); async function save () { setStatus ( " saving " );...
Source: [Dev.to](https://dev.to/childrentime/react-uselatest-hook-read-fresh-state-in-async-callbacks-2026-24hb)