3 ms·
I learned React to know what it was about and what people were talking about. I think a lot of people get the wrong idea about React. They say the virtual DOM i
by moron4hire 5y ago
I learned React to know what it was about and what people were talking about. I think a lot of people get the wrong idea about React. They say the virtual DOM is the most important feature, but I think it's actually the fact that it forces you to componentize your code. And it does this by making non-componentized code very painful to work with, so you have to componentize to be able to have any shot at getting React to work.
But if you already have the componentization mindset, I don't think React really adds anything. As you have said, managing raw DOM operations can be significantly faster. And because you have componentized your code, they are significantly easier to reason about.
The only problem is that working with a medium-sized smash of code is not as painful in vanilla JS as it is in React. So if you've grown your application over time, adding bits and bobs to it piecemeal, you're likely to end up with an application structure that is inherently difficult to manage. Then folks rewrite in React, get forced to componentize, and lo-and-behold, everything is much easier to manage.
At this point, whatever gets you there, gets you there, I guess. Personally, I make VR applications that run in the browser, so I coveteth performance.
- jl2718 5y agoI like the components. I do not like having to do everything through a JSX template. I do not like debugging through a transpiler. I do not like testing a DOM tree I didn’t build. Just my novice view.
- sebular 5y agoYou're going to struggle as a novice if you're quick to form opinions about things that you don't fully understand, especially if those opinions involve rejecting wildly popular tools used by people with far more expertise than you have. People who understand React/Vue/Angular are free to criticize them (and have many valid reasons for doing so), but when you do it after following a beginner tutorial or two, you're just being ignorant. How do I know this? Because you're criticizing React for forcing you to "do everything through a JSX template" and "debugging through a transpiler", which tells me that you aren't aware that React can be used without JSX and without any transpiling. Since that information is available to you on about the fourth paragraph of the "Getting Started" page on reactjs.org, you clearly haven't bothered to learn much about it at all.
- RussianCow 5y ago> I do not like testing a DOM tree I didn’t build. What does this mean?
- danenania 5y agoModularity or componentization as you call it (I like that! :P) is definitely one of React's main advantages. But I'd say just as important is that it acts as a trojan horse, essentially, to get people using the "good parts" of functional programming without having to understand FP deeply. Just like React encourages components, it also encourages immutable data, one-way data flow, functional reactivity, and thinking in terms of state machines, even if you aren't necessarily familiar with that terminology. All this stuff makes building a complex UI far more manageable and helps to avoid common pitfalls.
- beebeepka 5y ago"I know almost nothing about the subject at hand, so here's my expert opinion on it"
- moron4hire 5y agoI've been a software developer for 20 years. I've been doing JavaScript since it was invented. I do actually know a lot about these things.
- beebeepka 5y agoThat's not what you said initially. Nice bait
- moron4hire 5y agoI didn't say anything about my past experience. Is it so incomprehensible that people did massive amounts of web development before React was even a twinkle in someone's eye? Is it so incomprehensible that someone could learn React and then choose not to continue to use it?
- beebeepka 5y agoI actually don't like react. The whole thing reeks of religion. I do like Vue and Svelte, though. They let me do powerful things without getting in the way. Native APIs are fine but eventually you're gonna need some more abstractions in order to scale beyond a garage app. Frankly, I tend to write my own stuff on the backend but there's so much more work on the front end, you end up either adopting or building a framework.
- jl2718 5y agoConfession: when I say “completely new to JavaScript”, I mean that I once used it to make badly-animated pages as a kid in the 90s. It’s completely different now, so I say I’m a complete beginner.
- dragonwriter 5y ago> They say the virtual DOM is the most important feature Who says that now? I mean, in recent years VDOM seems to be more often criticized as the problem (with performance, but also otherwise) with React, even by people who like its basic dev-facing structure. Which is why you see frameworks with JSX and React-like structure (even Hooks, but without the explicit dependency pain point in the case of Solidjs) whose key selling point is no VDOM.