Storage interview questions
Practice 4 questions on storage. Each runs in a real in-browser editor with Jest tests and a worked, diagram-backed solution.
4 questions
- EASY
useLocalStorage
Implement a useState-like hook that persists to localStorage, with SSR-safe init and cross-tab sync.
15 minJavaScript - EASY
useSessionStorage
Implement a useState-like hook backed by sessionStorage, with a graceful fallback when it is unavailable.
15 minJavaScript - MEDIUM
localStorage With Expiry
Implement a localStorage wrapper that stores values with a TTL and returns null once an entry has expired.
25 minJavaScript - MEDIUM
useCookieState
Implement a useState backed by a cookie — state the server can also write, with no event when it does.
25 minJavaScript