2 ms·
> Unless your job is going to require a framework, it’s really not necessary. Respectfully disagree. Mirroring your state in the DOM on your own is incredibly
by klabb3 4y ago
> Unless your job is going to require a framework, it’s really not necessary.
Respectfully disagree. Mirroring your state in the DOM on your own is incredibly easy to get wrong. Doesn't matter if it's react, svelte or vue, any such framework will greatly simplify the UI parts. Aside from that though, I agree you can (and probably should) avoid most deps.
- cube00 4y agoI found using web components with Lit got me most of the way there to allowing individual components to self contain their state and redraw as required when state changed.
- jefftk 4y agoFor prototyping and simple things, instead of mirroring my state in the DOM, I use the DOM to store state. Yes, it isn't quite as performant, but for this sort of work that doesn't usually matter.
- _gabe_ 4y ago> For prototyping and simple things, instead of mirroring my state in the DOM, I use the DOM to store state. I find it funny that people think mirroring the DOM will magically make your web app performant. I've visited plenty of React sites that are sluggish, bloated, load slowly and a pain to use. I've also visited plenty of plain ol' HTML/CSS/JS sites that are snappy, load quickly, and fast enough. No framework or clever algorithm will save you from crappy code ;)
- jefftk 4y agoI don't think it will magically make your code performant, but I've written things where using the DOM for state was pretty painfully inefficient. For example, multiple queries over a large amount of data where data is only represented as DOM notes. When working on small things and prototypes, though, this has been the exception, and I'm happy to mostly just use the DOM.