useSessionStorage
Keep a piece of state in sessionStorage as JSON. The value survives a reload but is cleared when the tab closes, which suits wizard steps and temporary form input.
- Level
- Intermediate
- Since
- v1.0.0
import {useSessionStorage} from '@zenuilabs/react-hooks';Loading demo_
More in State
StateAdvanceduseBroadcastStateState that stays in sync across every open tab of your site. Uses BroadcastChannel and falls back to the storage event.StateBasicuseCounterHold a number with stable increment, decrement, set and reset helpers. Optional min, max and step options keep it inside a range, which suits quantity pickers and pagers.StateIntermediateuseLocalStorageKeep a piece of state in localStorage as JSON, synced across components and browser tabs. Use it for preferences and drafts that should survive a reload.