Thanks, great article.
Had trouble how to access variables from Server, what i missed: i had to export the variable from the javascript, so the code is:
Controller (see: inertia docs)
def index
render inertia: 'svelte/index', props: { backend_var: 'Backend' }
end
Svelte (see: svelte docs)
<svelte:head>
<title>Hello {backend_var}</title>
</svelte:head>
<script>
export let backend_var
</script>
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks, great article.
Had trouble how to access variables from Server, what i missed: i had to export the variable from the javascript, so the code is:
Controller (see: inertia docs)
Svelte (see: svelte docs)