How to make dependent $state rerender?

2025.01.20 07:41 Nervous-Project7107 How to make dependent $state rerender?

In trying to replicate a pattern that I use a lot in react, where you have a $state that holds the a input value, but another $state that holds sanitized data.
If the $state in input is good, you modify the parent $state.
It seems that the parent state is modified in this following code, however any change to the parent $state does not modify the child $state. I tried using $derived but seems you can't reassign to $derived.
Here's the code:
logic.svelte.js ```javascript class Data { curr = $state("parentdata"); reset() { this.curr = "parentDataWasReseted"; console.log("if you see this the data was reset", { curr: this.curr }); } }
export let parentData = new Data(); ```
+page.svelte ```svelte

{data.curr}