All situations
2
The second Astro island needs the same cart.
Context stops at its root. A store doesn't.
ReactVue
const cart = useStore($cart)
return <span>Cart ({cart.length})</span>$cart = atom([])
<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 nanostoresReact Context keeps growing →One state for several frameworks →