svelte - Object destructuring for components -


i want able destructure object when pass svelte component. this?

var o = { item: "bread", count: 12 }  <component ...object> 

within component

<b>{{item}}:</b> {{count}} 

currently seems have manually this

<thing item={{thing.item}} count={{thing.count}} /> 

there discussion this while back, , decided hold off implementing spread attributes @ time because of concerns on how impact static analysis svelte does. it's still open debate though.

something might if added destructing in each blocks, mean use compact :foo (equivalent foo='{{foo}}') so:

{{#each things {item, count} }}   <thing :item :count/> {{/each}} 

there isn't open issue that, should feel welcome create one! see doing @ point.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -