feat: support passing signals as island props (#757)
This commit adds support for passing signals to islands in component props. This is useful for passing around mutable state between islands. The signal's value needs to be serializable for this to work.
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
import { useSignal } from "@preact/signals";
|
||||
import Counter from "../islands/Counter.tsx";
|
||||
|
||||
export default function Home() {
|
||||
const count = useSignal(3);
|
||||
return (
|
||||
<div>
|
||||
<p>
|
||||
Welcome to Fresh. Try to update this message in the ./routes/index.tsx
|
||||
file, and refresh.
|
||||
</p>
|
||||
<Counter start={3} />
|
||||
<Counter count={count} />
|
||||
<Counter count={count} />
|
||||
<Counter count={count} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user