Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 1.25 KB

File metadata and controls

49 lines (35 loc) · 1.25 KB

Seitu

npm version You need Seitu

Seitu is a lightweight, framework-agnostic, type-safe utilities library for JavaScript applications on the client and server sides.

Documentation

You can find the documentation here.

Example

To quick start you only need to write the following code:

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

const value = createWebStorageValue({
  type: 'sessionStorage',
  key: 'test',
  defaultValue: 0,
  schema: z.number(),
})

value.get() // 0
value.set(1)
value.remove()
value.subscribe(v => console.log(v))

function Counter() {
  const count = useSubscription(value)

  return (
    <div>
      <span>{count}</span>
      <button onClick={() => value.set(c => c + 1)}>Increment</button>
    </div>
  )
}

Seitu has other powerful features, so check out the docs or the examples directory.

License

MIT License - see the LICENSE file for details