Question · Vibe coding with Claude Code course · Module 3: Twitter clone

Saving to localStorage

How do you save a posts array to localStorage?

Answer options

  • localStorage.posts = posts
  • localStorage.save(posts)
  • localStorage.setItem('posts', JSON.stringify(posts))
  • setPosts(localStorage)

You can check the correct answer by solving this task in the CodeWorlds game.