Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How to data bind with pageData?

$
0
0

If I bind directly to data, like:

type Props = {  data: PageData;};let { data }: Props = $props();<input bind:value={data.product.name} />

I get the following warning:

[svelte] binding_property_non_reactivebind:value={data.product.name} (src/routes/...) is binding to a non-reactive property

if I destructure as $state(), like:

type Props = {  data: PageData;};let { data }: Props = $props();let { product } = $state(data);<input bind:value={product.name} />

the warning is gone, but then i lose reactivity when the data prop changes..

How can I bind, and not lose reactivity?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>