Text boxes are a complex and sensitive issue: how and where do you store the text, and how do you update event listeners when a change happens.
HTML’s storage of state in the DOM is storing information onto the View Component itself. Let’s call this strategy “binding to the left-side”. An alternative, would be to store the information into the environment that manages and calls the listeners. Let’s call this second strategy “binding to the right-side”. From this perspective, we can see that in HTML/JS, data is shared between the left and right side. This is basically an ideal solution to the View-State problem, however the question now is “How can we do the same in Rust”?
The second solution, which is used in Lattice, is to go with a restricted FRP style. This means that object state is stored “near” the left side, but not quite on the View Component. Managed by the engine there is an associated value for each view component and channels that listeners can subscribe to. When a component wants to update its state, it will call the state-setter function builtin to every Component. There may be multiple bound values of different types for each Component. Then, the engine checks whether a subscriber should be notified of the changes, and if so, fires off an event to the listener.
I still hope that in the future, Rust closures will have more options and better defaults with regards to scoped variables, but for now there are plenty of workarounds.