Svelte – Error: {#each} only iterates over array-like objects.

Admin Svelte Errors

Error in Svelte {#each} only iterates over array-like objects.

Error

index.mjs:1569 Uncaught Error: {#each} only iterates over array-like objects.
at validate_each_argument (index.mjs:1569)
at create_fragment$1 (App.svelte:205)
at init (index.mjs:1424)
at new App (App.svelte:126)
at app.js:3
at app.js:8

Solution

We need to turn our data into an array:

let stocks = [];

Leave a Reply

Write your comment if you have something on the topic of the current article:
"Svelte – Error: {#each} only iterates over array-like objects."