Hacker News new | ask | show | jobs
by christophilus 1335 days ago
> Some very basic things like show/hide images and blocks of text based on user selection require an obscene amount of code/complexity in React

That’s just a ternary conditional in React. How is it complex?

1 comments

I'd encourage you to write it once in vanilla and once in React in jsfiddle and compare the implementations.

Then consider the render model and how it would affect page time to interactive for a large content oriented page.

I’ve written this sort of thing in both. Personally, I find the “make your view a function of your state” approach to be much easier to reason about and more maintainable. Obviously, not if the only thing your site does is this one feature. But as soon as your site becomes non-trivial, I prefer the functional / React approach.
Well, frameworks vs vanilla JS doesn’t cash out into whether it’s hard to write ‘element.style.display = “…”’ or not.