Getting Started
Introduction
A simple and easy-to-use state manager that utilizes nanostores as its core implementation.
Installing the library
Install @codeleap/store through bun:
bun add @codeleap/store
Setup
Import globalState from the library and define your state:
src/stores/example.ts
import { globalState } from '@codeleap/store'
const initialState = {
  modal1: false,
  modal2: false,
}
export const state = globalState(initialState)
export function toggleModal(modal: keyof typeof initialState, value?: boolean) {
  const newValue = typeof value === 'boolean' ? value : !state.value[modal]
  state.set({ [modal]: newValue })
}