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

How do I pass props in each blocks in Ssvelte

$
0
0

I'm a bit confused with Svelte's props.I have a component named Assignment which I will use in my Board component.I wish to have a dynamic array prop in my Assignment's {#each} block.

<script>    export let array</script><div {array} class="flex-column"><div class="row-item"><h4>Open</h4>        {#each {array} as value}<div class="description"><p>{value.status}</p><p>{value.name}</p></div>        {/each}</div></div>

Above is my Assignment component

My wish is for me to able to do something like this:

<div class="flex-container"><Assignment        {myArray}    /><Assignment        {myArray2}    /></div>

With a new array in each component call. So I guess my question is: How do I pass a prop into a each block?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



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