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

How can I receive arbitrary props in a Svelte component and pass to a child component?

$
0
0

I want to receive arbitrary props from "above" and spread them onto an <input>, as shown here where inputProps would become an object containing any additional props set on this component (similar to python's **kwargs, in case you're familiar):

<script>export let id;export ...inputProps;</script><div>    id: {id}<input {...inputProps} /></div>

Can you point me toward the correct Svelte mechanism for accomplishing something like this? I have a feeling that I'm asking the wrong question, but I need a svelte developer to set me straight. Should I use a slot instead? Or learn about actions / "the use directive"?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



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