All situations
Mostly HTML. A few parts need the same state.
One small store. No SPA, no syncing by hand.
document.querySelectorAlladdEventListener
Pricing
Starter $9Team $29
export const $period = atom<Period>('monthly')
$period.subscribe((period) => {
for (const el of document.querySelectorAll<HTMLElement>('[data-price]')) {
el.textContent = el.dataset[period] ?? ''
}
})
toggle.addEventListener('change', () =>
$period.set(toggle.checked ? 'yearly' : 'monthly'),
)Just one local toggle? Plain JavaScript is enough.
npm install nanostoresNo app logic in React hooks →Two islands need the same data →Persistent Store ↗