Put in order · Vibe coding with Claude Code course · Module 3: Twitter clone

Persistence of posts in localStorage

Arrange what happens to the posts from opening the feed to saving:

Items to put in order

  • useState(loadPosts) loads the posts from localStorage on the first render
  • useEffect with [posts] saves the changed array to localStorage
  • The captain adds a new post through setPosts
  • Feed displays the posts on the feed

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