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

What is the correct way for updating a Svelte writable array store?

$
0
0

What is the correct way (or differences if both are correct) for updating a $orderItems = writable([]) Svelte writable array store? We'll assume result is a new item I want to push at the end of $orderItems.

orderItems.update(items => ([...items, result]))

or

$orderItems = [...$orderItems, result]

Viewing all articles
Browse latest Browse all 1541

Trending Articles



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