'How do I set a store value from a $lib/foo.js file?

I know I can call get with import { get } from 'svelte/store';

Is there a way to use set inside a $lib file in svelte?



Solution 1:[1]

I just have to call set on the store object:

import { location as loc } from '$stores/user';

loc.set(currentLocation);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1