A few weeks ago, I wrote a bit about state-based UI vs. traditional DOM manipulation and Web Components. I recently had a student ask when you should reach for React (or Vue, or some other state-based UI tool). When are the tradeoffs of using a tool like that worth the cost? In my opinion, the value kicks in when you have…
Example 1. A shopping cart UILet's say you have a shopping cart UI where the "add to cart" button and some link to go checkout are both tied to some data that tracks the items in your cart. Imagine a UI like this…
And that HTML is driven by a data object that looks like this…
With a state-based UI tool, any time you update the Without it, you're manually checking a bunch of different conditions and manually updating different things. There's a lot more places to go wrong, and the code becomes harder to read and maintain. State-based UI is a good choice here. Example 2. A todo listImagine a todo list where any given item in the list…
Changing any one of those variables might affect multiple pieces of UI.
And this is all driven by a bit of data, like this…
Here, all of the data is in a single component. But there are so many variables that can change based on a single piece of data changing. For example, changing
Here, using state-based UI instead of traditional DOM manipulation agains makes the code easier to read and maintain. You describe what the UI should look like based on certain conditions, and the library makes those changes based on the data. You don't need a library (but you might want one)You can theoretically do all of this stuff with traditional DOM manipulation. State-based UI just makes it easier. If I were picking on today, I'd personally reach out for either my own library, ReefJS, or Preact (like React, but more performant and no build required). Like this? A Go Make Things membership is the best way to support my work and help me create more free content. Cheers, Want to share this with others or read it later? View it in a browser. |
Related Post:
- Former Leader of Clan Del Golfo Drug Trafficking Organization Sentenced to 45 Years in Prison for Operating a Continuing Criminal Enterprise and Related Charges
- [WATCH 82+] Shrapnel (2023) FULL MOVIE ONLINE FREE ENGLISH/Dub/SUB Action STREAMINGS ������������
- Nokia, TPG Telecom and MediaTek demonstrate 360-degree video broadcasting using 5G Uplink Carrier Aggregation
- [Nézze 69+] meg a 封神第一部:朝歌风云 teljes filmet (2023) - online Fantasy film ������������
- [Nézze 23+] meg a Sympathy for the Devil teljes filmet (2023) - online Thriller film ������♂️
0 Komentar untuk "[Go Make Things] When should you use React?"