[All situations](/)

2

# The second Astro island needs the same cart.

Context stops at its root. A store doesn't.

`React``Vue`

Header island · React

```
const cart = useStore($cart)
return <span>Cart ({cart.length})</span>
```

$cart = atom(\[])

Catalog island · Vue

```
<script setup lang="ts">
const cart = useStore($cart)
</script>

<template>
  <button @click="addItem(product)">Add ({{ cart.length }})</button>
</template>
```

Separate bundles must share one copy of the store module.

`npm install nanostores`

[Getting started →](/docs/getting-started/)

[React Context keeps growing →](/for/outgrowing-context/)[One state for several frameworks →](/for/multi-framework/)
