@tolokoban/react-state
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

@tolokoban/react-state

import AtomicState from "@tolokoban/react-state"

export default {
    language: new AtomicState(navigator.language, {
        storage: {
            id: "language",
            guard: isString,
        },
        transform(value: string) {
            const lang = value.trim().substring(0, 2).toLocaleLowerCase()
            return ["en", "fr"].includes(lang) ? lang : "en"
        },
    }),
    events: {
        list: new AtomicState<TpEvent[] | null>(null),
    },
}

Readme

Keywords

none

Package Sidebar

Install

npm i @tolokoban/react-state

Weekly Downloads

11

Version

0.2.0

License

none

Unpacked Size

11 kB

Total Files

8

Last publish

Collaborators

  • tolokoban