How can I make the data prop bindable for editing?
#13401
|
I'm currently trying to make a site where the content can be edited, but there's no approach I have found that allows data to be updated as edits are made without breaking data reactivity between pages. Essentially, my page has a value
What I've tried:
For reference, here is the code I am working on I'm completely stumped for what to do here. How can I approach this? |
Replies: 3 comments
|
I figured out why using an By using an Even still, this feels extremely janky, and so I'd love to know if there is a better approach. |
|
There is a another pattern using const item = $derived.by(() => {
const state = $state({ current: data.item });
return state;
});
|
|
Future readers: as of Svelte 5.25 (PR sveltejs/svelte#15570) $derived()-runes are writable. This means you can derive from server data AND write to it optimistically. |
Future readers: as of Svelte 5.25 (PR sveltejs/svelte#15570) $derived()-runes are writable. This means you can derive from server data AND write to it optimistically.