Web
Web Storage
Reactive handle for localStorage or sessionStorage.
createWebStorage()
Reactive handle for localStorage or sessionStorage. On the server, get()
and the SSR snapshot are defaultValues.
Examples
Vanilla
import { } from 'seitu/web'
import * as from 'zod'
const = ({
: 'sessionStorage',
: {
: .().(),
: .({ : .(['light', 'dark']) }),
},
: { : null, : { : 'light' } },
})
.()
.({ : 'abc' })
.() // { token: 'abc', preferences: { theme: 'light' } }
.(.)React
'use client'
import { } from 'seitu/web'
import { } from 'seitu/react'
import * as from 'zod'
const = ({
: 'sessionStorage',
: { : .(), : .() },
: { : 0, : '' },
})
export default function () {
const = ()
return (
<>
<>{.}</>
<>{.}</>
</>
)
}Edit on GitHub
Last updated on