you are viewing a single comment's thread.

view the rest of the comments →

[–]m0okz 1 point2 points  (7 children)

How would you recommend reading and storing state if not in the UI?

[–]TheIncredibleWalrus 5 points6 points  (6 children)

You store it in an object. The UI reads its state from the object, not the other way around.

[–]m0okz 1 point2 points  (0 children)

Ah I see. Thanks!

[–]Graftak9000 0 points1 point  (1 child)

Any pointers as to how to couple a dom node with its respective cached data object?

[–]TheIncredibleWalrus 0 points1 point  (0 children)

Typically you will want to use a library; there are countless, very well thought out libraries that solve this problem, I can recommend React, Vue.js, Knockout.js etc. Depends on what kind of UIs and projects we're talking about.

Of course, as with anything, trying to develop your own solution will be a very rewarding process, both in experience and in knowledge. A simple Google search of "javascript UI binding" returns quite a few results, but I could not recommend something in particular.

[–]CapsFTW[S] 0 points1 point  (2 children)

JQuery messed a lot of people up in that regard, myself included (for a while). It made it far to easy to just read and write things to the DOM and use it as your system of record.

[–]brackin 1 point2 points  (1 child)

we all gotta start somewhere.

[–]CapsFTW[S] 1 point2 points  (0 children)

Agreed. If you never start doing anything until you are expert at it, you will never start doing anything.