Persistence
5 min read
Keep the Board After Refreshing
Keep the Board After Refreshing
React state is temporary. If the page reloads, the component starts again with its initial value.
In this module, you will connect the existing tasks state to localStorage:
browser storage
↓
load tasks
↓
React state
↓
user actions
↓
setTasks(...)
↓
save tasks
The important idea is that localStorage is a persistence layer, not a second source of truth for the UI. React state remains the value that the components render.
Checkpoint
Before starting, create a task, delete a task, and move a task. Confirm that the changes work during the current session. In this module, we will make those changes survive a refresh.