getValdresContext

Signature
getValdresContext(): Store

valdres-svelte Access the current store instance

Retrieves the valdres store from the nearest setValdresContext in the component tree. Use this when you need direct store access.

Usage

<script>
import { getValdresContext } from "valdres-svelte"

const store = getValdresContext()

function logValue() {
    console.log("Current:", store.get(myAtom))
}
</script>

<button onclick={logValue}>Log value</button>

See also