It could be that I'm typing the wrong things in Google and can't get a good answer.
Is there a "svelte recommended" way to store the value of a GET result, so that, on every refresh or link switch, the result in the store is used in the component until a timeout (where the api is called again)?
my purpose is to fetch blogposts from external api and show them in a list but not on every refresh, or link switch
my code:
<script>
let posts = [];
onMount(async () => {
const res = await fetch(apiBaseUrl + "/blogposts");
posts = await res.json();
});
</script>
{#each posts as post}
<h5>{post.title}</h5>
{/each}
in pseudocode what i want
if(store.blogposts.timeout === true){
onMount(...);
//renew component
}