One thing I love about React/Redux development is having a single source of truth for application state.
But, from a decentralized web perspective, I *hate* how this pushes state out of the HTML. In my view, HTML should have all content, and state is (often) part of content; "view source" should mean something.
Would it be possible to invent an alternative paradigm that keeps all state in the HTML, maybe using data attributes? Or does that paradigm already exist?
@codesections There's the local storage APIs, but the problem with client-side web stuff in general is that the security model is entirely based on which server things come from. There's no concept of an entity separate from its origin. We really need some concept of "installed" applications. WebExtensions come kinda close, I guess.
@freakazoid What is the security concern with having the single source of truth in HTML versus JS? I agree with what you said, but I'm missing the connection
@codesections It's not so much a security concern as it is that the web site still "owns" the data even if it's stored in your browser. It is, as you say, more transparent to you, though.
@codesections I saw a presentation once of a framework that uses html to store all information, but I can't remember the name
@codesections
I think stimulusjs comes pretty close to your suggested paradigm. It works on top of server side rendered html pages, and adds logic as specified by data attributes. It also stores state in the data attributes.
@codesections I'm sure for many use cases, data attributes could work just fine.