4 ms·
I make dynamic apps and I have never had this issue with state. I've made visualization generators, image editors, live charts and html editors that run in the
by archerx 2y ago
I make dynamic apps and I have never had this issue with state. I've made visualization generators, image editors, live charts and html editors that run in the browser. the stuff I'm making has a lot changing elements and handling the state is not an issue for me. Maybe it's because I learned programming from game development I see web dev with a different perspective?
- lomase 2y agoHow do you know how to repaint the screen when a variable changes without blocking the UI?
- throwawayffffas 2y agoTo slightly refine your question. When a variable changes how do you know which UI elements have to be updated? I think his answer is obviously all of them.
- throwawayffffas 2y agoSo 10 years ago when React was made public the default way to handle changes on the web was to have a bunch of event handlers that would go over the DOM and make appropriate mutations. That's kind of typical of retained mode user interfaces. To this day that's kind of how things like QT and GTK kind of work. There are things like data binding, etc. But that's what they do under the hood. When you are working like that it's easy to forget to do mutations on specific UI components or to make mistakes about the mutation that has to happen. React handles the mutations, it takes your code, feeds it the current state and gets back what the ui should look like, and then it does a diff with what's on screen and updates accordingly. If you are coming from game development you are probably used to immediate mode UIs where you specify and update the entire user interface every time.