Seitu
Web

Web Storage Value

Reactive handle for one localStorage/sessionStorage key.

createWebStorageValue()

Reactive handle for one localStorage/sessionStorage key. On the server, get() and the SSR snapshot are defaultValue.

Examples

Vanilla

session-storage.ts
import {  } from 'seitu/web'
import * as  from 'zod'

const  = ({
  : 'sessionStorage',
  : 'token',
  : .().(),
  : null,
})

.()
.('abc')
.()
.(.)

React

page.tsx
'use client'

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

const  = ({
  : 'sessionStorage',
  : 'count',
  : .(),
  : 0,
})

export default function () {
  const  = ()
  return (
    <>
      <>{}</>
    </>
  )
}

Edit on GitHub

Last updated on

On this page