useStore
Signature
useStore(): Storevaldres-solid Access the current store instance
Returns the current valdres store from the nearest ValdresProvider. Useful for imperative operations.
Usage
import { useStore } from "valdres-solid"
function Debug() {
const store = useStore()
const handleClick = () => {
console.log("Current:", store.get(myAtom))
}
return <button onClick={handleClick}>Log value</button>
}
See also
- ValdresProvider — provide a store to the component tree
- store — create a store instance