---
# System prepended metadata

title: Recursive Store
tags: [Stores]

---

# Recursive Store

> * 如有錯誤處指正或任何建議，懇請留言，感謝!
> * 搭配 ChatGPT 進行翻譯，請小心服用
> * ▸ ... 為英文原文


:::spoiler ...
This example features a store that contains other objects rather than just primitives. The `store.counter` property is an object literal.

The example doesn't work as is, because by default the `useStore` function only watches top-level properties.

To make the example work, you need to do one of two things:

1.  Wrap `{count:0}` in another [`useStore()`](https://qwik.builder.io/docs/components/state/#usestore) call (which is a bit cumbersome)
    
2.  Allow `useStore` to recursively apply reactivity to all properties by passing the additional argument: `{recursive:true}`.
    

> **Your task:** Update the sample with the [`useStore()`](https://qwik.builder.io/docs/components/state/#usestore) function.

Note that stores are not tied to any single component. In fact, you can pass stores from one component to another.

::: 



###### tags: `Stores`