|
|
|
|
|
by dimeatree
916 days ago
|
|
State management seems a bit counter intuitive at a glance. I found this statement to be confusing; https://vanjs.org/tutorial#state-val-is-immutable
While you can update State objects by setting the val property, you should never mutate the underlying object of val itself. Then beneath is an example of the following; const text = van.state("VanJS")
...
input({type: "text", value: text, oninput: e => text.val = e.target.value})
Which looks like a mutation - after reading a bit more around it is clearer that .val has a setter; but at a glance it just isn't obvious what is happening which I feel isn't intuitive. |
|