Skip to main content

Session gluon (client)

The session gluon work exactly like the local gluon, the only difference is that the value is persisted in the session storage of the browser.

Usage

import { gluon } from "stayte";

const countGluon = gluon('count', {
from: 'session',
defaultValue: 10
})

console.log(countGluon.get()) // 10
countGluon.set(20) // <-- this will update the session storage
console.log(countGluon.get()) // 20

Demo