-
It's probably a common question but I couldn't find the answer. I have a
export async function load({ fetch, params, url }) {
let item = await fetchItemFromDb();
return {item }
}
<script>
export let data;
let item = data.item;
</script>
{data.item.title} Then I have a navigation bar with links to I go to
So if I update <script>
export let data;
let item = data.item;
$: if (data) {
console.log(data.item.title)
}
</script>
{item.title} When I click on How can I get it to render the new data? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
Ah, duh... I simply have to declare
<script>
export let data;
$: item = data.item;
</script>
{item.title} |
Beta Was this translation helpful? Give feedback.
-
@eallenOP I did a minimal repro and it always works, I don't really know what you might be doing differently, whenever PS: Whenever possible, use |
Beta Was this translation helpful? Give feedback.
-
did anyone try to make it work in Runes mode |
Beta Was this translation helpful? Give feedback.
Ah, duh... I simply have to declare
item
with a reactive statement, otherwise sveltekit doesn't know it has changed...+page.svelte