import React from "react"
import { createStore } from "@corets/store"
import { useStore } from "@corets/use-store"
const globalStore = createStore({ count: 0 })
const Example = () => {
const store1 = useStore(() => ({ count: 0 }))
const store2 = useStore(globalStore)
// alternative syntax
const [store, setStore] = useStore(globalStore).use()
const increment = () => store1.set({ count: store1.get().count + 1 })
return (
<div>
<button onClick={increment}>Count: {store1.get().count}</button>
</div>
)
}