Skip to main content

All Questions

Tagged with
2 votes
0 answers
62 views

sveltekit client - array available sporadically in reactive function

An app showing a list of building systems components with the ability to add a component. Database is Mongodb. +page.js fetches the list, a definition of the table + populates "lookup" lists ...
minisaurus's user avatar
  • 1,196
0 votes
1 answer
47 views

How to use an array from a JS file to a Svelte file

I have a function in a +page.js file that return { props { data } }. Data is an array. However when I try to use it in svelte with export let data It says that it's not an array What should I do ?
Zefus's user avatar
  • 11
1 vote
2 answers
298 views

How can I limit object from an array in svelte

I'm searching in svelte documentation about this, but I can't get it. What I want is to show only 4 objects from an array For example: let data = [ {id:1, name: 'John'}, {id:2, name: 'Peter'}, ...
Eyad Farah's user avatar
1 vote
3 answers
2k views

Why is Svelte not re-triggering a function and/or rerendering when some variable changes? [duplicate]

I'm relatively new to Svelte and I understand some basic concepts. I know that it's reactive on assignment. But I can't seem to figure out why exactly this doesn't work. Here's a little demo snippet ...
ruky's user avatar
  • 33
0 votes
1 answer
295 views

How do I pass props in each blocks in Ssvelte

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> ...
Malthe22's user avatar
1 vote
1 answer
2k views

How to set a svelte store to an object array

Hello I am requesting a json file from a flask server, after processing the response I know have the json file showing up in the console.log. The json file contains and array of objects of type ...
Stephen Okita's user avatar
0 votes
3 answers
96 views

Calling array object in src does not work

I have an array : let x = ''; let elements = [ { icon:"Home",name:'Home',page:'Page1' }, { icon:'Cube',name:'New',page:'Page2' }]; I am looping in it: {#each ...
equi's user avatar
  • 164
0 votes
2 answers
2k views

How to handle dynamic array with svelte/store

I would like to receive several data from different APIs and put it together in one big array. This array should be accessable for different components. The components should list the array, if all ...
dscorp's user avatar
  • 3
11 votes
2 answers
13k views

How to access websocket in svelte?

<script> const socket = new WebSocket("ws://localhost:8000/chat") socket.addEventListener("open", ()=> { console.log("Opened") }) </script&...
yawad's user avatar
  • 143