0
votes

I am trying to bind a variable from my store to a component, but get the error:

[!] (plugin svelte) ValidationError: Cannot bind to a variable which is not writable

Here is my sample code:

<Textfield bind:value={startDate} label="Start Date" type="datetime-local" />
1

1 Answers

1
votes

To use a store variable, one can rely on the "update" callback, or use the specific syntaxe

<Textfield bind:value={$startDate} label="Start Date" type="datetime-local" />

More information on the Svelte tutorial: https://svelte.dev/tutorial/store-bindings