Setup
Install package
npm install @devlab/store
Usage
import { createStore } from '@devlab/store'
type UserData = {
name: string;
job?: string;
}
const userStore = createStore<UserData>({
devtools: "User Store",
initialData: { name: 'John' },
fallbackData: { name: "Guest", job: "Unemployed" }
})
export function UserProfile() {
const name = userStore.use('name');
return (
<div>
<h1>{name}</h1>
</div>
)
}