astro/.changeset/itchy-tigers-help.md
Matthew Phillips 5e46be5468
Support shared signals in Preact islands (#4763)
* Support signals in Preact islands

* Add a changeset

* Only add signals if we need them

* Refactor signal logic into its own module

* Keep track of the signals used
2022-09-21 15:21:21 -04:00

22 lines
481 B
Markdown

---
'@astrojs/preact': minor
'astro': patch
---
Shared state in Preact components with signals
This makes it possible to share client state between Preact islands via signals.
For example, you can create a signals in an Astro component and then pass it to multiple islands:
```astro
---
// Component Imports
import Counter from '../components/Counter';
import { signal } from '@preact/signals';
const count = signal(0);
---
<Count count={count} />
<Count count={count} />
```