2 ms·
So 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 mak
by throwawayffffas 2y ago
So 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.