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

Loading data server side and allow global access client side

$
0
0

I'm having a hard time understanding the use of Runes and data loading.I load a supabase json file and I want to access the data globally.

// +page.server.jsexport async function load() {    const [_portfolioSummary, error] = await getFullPortfolio('/');    return _portfolioSummary;}
// shared.svelte.jsexport let portfolioSummary = $state({});
// +page.jsimport { portfolioSummary } from '../lib/js/shared.svelte.js';export async function load({ data }) {    portfolioSummary = data.portfolioSummary;}

I get this error:

TypeError: Cannot set property portfolioSummary of #<Object> which has only a getter

What should I do to get portfolioData globally so I can use it anywhere?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



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