Question · Vibe coding with Claude Code course · Module 12: Medium clone
The autosave that passed the test
Which autosave version passed the test "saves after 30 s although the captain writes without a pause" with a fake clock?
Answer options
- A setInterval started once, which calls a function from useEffectEvent and saves the latest draft if it changed since the last save
- setTimeout in a useEffect with the dependency [draft]
- setInterval in a useEffect with an empty dependency array, which saves the draft remembered at the first render
- A write to localStorage on every render of the component
You can check the correct answer by solving this task in the CodeWorlds game.