svelte-store Questions
2
Solved
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 $o...
Capitalize asked 25/5, 2022 at 14:59
3
Solved
Background
I am attempting to develop a cross-platform desktop app using Svelte and Tauri
When the app starts i need to load a settings.json-file from the filesystem into a custom Svelte store.
It ...
Crapulent asked 8/4, 2022 at 23:40
13
Solved
Is there any direct option to persist svelte store data so that even when the page is refreshed, data will be available.
I am not using local storage since I want the values to be reactive.
Hogback asked 7/6, 2019 at 5:0
1
I'm looking for an way to mock/stub stores that are used in Svelte components, specifically with the auto-subscribe syntax (ie $myStore or $myStore.property).
I've tried a couple of different mocks...
Whisk asked 20/11, 2021 at 0:15
2
I have a load function in SvelteKit. It fetches some data.
Is there a way I can display a loader before load function resolves? Or have some SSG that will be updated once SSR is resolved? Anything ...
Allynallys asked 18/2, 2022 at 0:9
4
Solved
One of my components is subscribed to a variable in a store. Whenever there is a change in that store var, I want to trigger a function.
stores.js
import { writable } from "svelte/store"...
Myronmyrrh asked 16/11, 2020 at 13:25
1
I am new to sveltekit and svelte in general, and I am trying to load data from an API to the stores, here is how I am doing it
export const load = async ({ fetch }) => {
const data = get(dataS...
Bellay asked 9/3, 2022 at 16:25
3
Solved
How to pass data (ex: Navbar Title) to a component used in the parent element?
<!-- _layout.svelte -->
<script>
import Nav from "../components/Nav.svelte";
let navTitle = &q...
Phares asked 30/8, 2020 at 2:48
1
Solved
When using SvelteKit, the store must always be created in the route page/layout, otherwise there will be problems with the status being up-to-date after refreshing.
You can't create a store in an i...
Burch asked 30/8, 2022 at 13:41
2
Solved
I have a writable store with following data
let array= writable({
skills: [{
id: 1,
name: "Wordpress",
knowledge: 0.9
},
{
id: 2,
name: "Js",
knowledge: 0.8
} ]
})
I want to animat...
Chaotic asked 6/12, 2019 at 18:10
1
Solved
I'm new to Svelte Store. Here in svelte tutorial, they used update() method in <Incrementer/> and <Decrementer/> components to update value. But in <Resetter/>, they used set() me...
Mute asked 12/2, 2022 at 11:11
2
Solved
How do I subscribe to a writable() instance of a class?
class User{
public money: Writable<number> = writable(0);
public goToJob(){
money.update(prev => prev + 100);
}
}
<script&...
Scarify asked 24/1, 2022 at 13:6
4
Solved
I am learning Svelte by creating simple app.
The logic is written using classes. The idea is, that all the data needed comes from class instance properties. Instances should not be instantiated mor...
Dread asked 13/7, 2020 at 21:6
2
Solved
The Svelte official tutorial employs such complex object in its document for <svelte:self>
let root = [
{
type: 'folder',
name: 'Important work stuff',
files: [
{ type: 'file', name: 'qu...
Aquarium asked 1/12, 2020 at 14:7
1
Solved
I have several Svelte components and a custom writable store. The store has an init function which is async and which fills the store's value with some REST API's db's table's data. My components m...
Erased asked 8/10, 2021 at 18:56
1
When testing svelte components, using jest & @testing-library/svelte, the state is shared between tests, is there away to tear down after each test so i have more isolated unit tests.
store/...
Madaih asked 1/4, 2020 at 12:40
2
Solved
I have a react app that uses ContextAPI to manage authentication and I am trying to implement a similar thing in Svelte.
In Authenticate.js I have this:
import React, { useContext, useState, useEff...
Risner asked 23/5, 2021 at 19:39
2
Solved
I don't understand this. I am trying to subscribe to a svelte store. But the closure function which is being passed to subscribe is being immediately invoked. Even though the value of the store has...
Horsa asked 26/3, 2021 at 14:22
1
I would like to warn a user to save his changes (form changes)before leaving the page. I want to trigger this alert if he clicks anywhere on the window. It could be the back button or reload or any...
Arvizu asked 9/2, 2021 at 3:42
1
Solved
I wanted to know if it is possible de type the dollar sign value of a custom svelte store ?
From this example :
app.svelte
<script>
import { count } from './stores.js';
</script>
<...
Zolnay asked 13/1, 2021 at 14:10
1
I have two components that are very far away in the component tree and I have doubts about how to communicate between both. I have the search component, listItems and a store.
store.svelte
<scri...
Music asked 6/1, 2021 at 22:38
1
Solved
I have 3 questions regarding Svelte Stores:
How do I make ajax request inside a store? I've tried using the following:
REPL Demo
//store.js
import { writable } from 'svelte/store';
let data = [...
Welter asked 12/11, 2020 at 6:32
4
Solved
I am wondering if i would be able to access my Svelte store values from a plain .js file.
I am trying to write functions returning a dynamic value based on a store value, to import them in any comp...
Chloramphenicol asked 1/12, 2019 at 14:22
3
Solved
Relevant REPL
I have a simple writable store with a custom set method:
import { writable } from 'svelte/store';
function createState() {
const {subscribe, set, update} = writable({a: 0, b: 0});
r...
Humphries asked 22/7, 2020 at 6:2
1
Solved
How to get store value from another store?
https://svelte.dev/repl/0ab80c2fb8e045958d844bd4b11c04a9?version=3.22.1
In the example I include a variable inputVal in stores.js file and changing in
se...
Godewyn asked 4/5, 2020 at 4:55
1 Next >
© 2022 - 2024 — McMap. All rights reserved.