React
ReactuseStore() hook
ASTRO + NANO STORES
Type in Vue. Count in Svelte. Pick a color in React.
Every island stays in sync.
useStore() hook
useStore() composable
Native $store subscription
useStore() hook
useStore() accessor
subscribe() with Alpine.data()
THE SAME STATE, PLAIN JAVASCRIPT
Hello islands · count 0 · doubled 0
Each island imports the same store module. Updating an atom notifies its subscribers across framework boundaries. Computed stores derive new values from that state.
import { atom, computed } from 'nanostores';
export const count = atom(0);
export const doubled = computed(count, value => value * 2);
count.set(count.get() + 1);import { useStore } from '@nanostores/react';
import { count } from '../stores/playground';
const currentCount = useStore(count);<script>
import { count } from '../stores/playground';
</script>
<output>{$count}</output>import { count } from '../stores/playground';
const unsubscribe = count.subscribe(value => {
output.textContent = String(value);
});
// Call unsubscribe() when the element is removed.Preact, Vue and Solid use their Nano Stores adapters. Alpine uses the same subscribe() API as the Astro readout. The source keeps each card separate so you can compare the implementations.