# 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

```svelte
<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

- [setValdresContext](https://valdres.dev/svelte/setValdresContext) — provide a store to the component tree
- [store](https://valdres.dev/valdres/store) — create a store instance
