Seitu - Type-Safe Utilities
Web

Session Storage Value

sessionStorageValue()

Creates a reactive handle for a single sessionStorage value.

Two modes:

  • Schema mode (schema, key, defaultValue): standalone key with validation. Missing or invalid stored data returns defaultValue.
  • Storage mode (storage, key): binds to one key of a createSessionStorage instance. Type and default come from that storage.

Example

import {  } from 'seitu/web'
import * as  from 'zod'

const  = ({
  : 'count',
  : 0,
  : .(),
})
.() // 0
.(1)
.( =>  + 1)
.()
.( => .())

Example

import { ,  } from 'seitu/web'
import * as  from 'zod'

const  = ({
  : { : .(), : .() },
  : { : 0, : '' },
})
const  = ({ , : 'count' })
.(5)
.(). === 5 // true

On this page