Live data from Hacker News

What I wish I knew about React

bitsofco.de

21–30 of 301 posts

Re: What I wish I knew about React

#21
post #8

(Opinionated post ahead...) React is, imo, garbage, but alas it's here to stay -- you know, kind of like Spring or Swing. In 10 years we're going to be wondering how the hell we ever used React 8 hours a day way back then. These kinds of markup frameworks/libraries were touted as jQuery's successor, but, from an architectural point of view, jQuery is by far their superior. "Everything an HTML tag" is an insane mantra…

I love reading about people's first principles technqiues of different technologies on HN! What do you think React will be supplanted by?

I've gotten by using a templating engine like Handlebars along with jQuery for async behavior for pretty much all of my apps. Reduced the time I spent building UIs a huge amount.

There are actually very few websites that 'require' an app-in-browser experience. And for many of those, clever usage of jQuery plugins works well enough.

Re: What I wish I knew about React

#22
post #15
post #8

(Opinionated post ahead...) React is, imo, garbage, but alas it's here to stay -- you know, kind of like Spring or Swing. In 10 years we're going to be wondering how the hell we ever used React 8 hours a day way back then. These kinds of markup frameworks/libraries were touted as jQuery's successor, but, from an architectural point of view, jQuery is by far their superior. "Everything an HTML tag" is an insane mantra…

These are all very, very weird points to raise, except maybe the SSR which is inherently hard to do.

Not if you've been doing web development for a few decades, which I feel the author probably has. I feel like people who came into web development during the past decade really don't understand how much simpler and easier things used to be. It really feels like web development has become crazy complex without much added benefit.

Re: What I wish I knew about React

#23
post #17
post #8

(Opinionated post ahead...) React is, imo, garbage, but alas it's here to stay -- you know, kind of like Spring or Swing. In 10 years we're going to be wondering how the hell we ever used React 8 hours a day way back then. These kinds of markup frameworks/libraries were touted as jQuery's successor, but, from an architectural point of view, jQuery is by far their superior. "Everything an HTML tag" is an insane mantra…

> It's crazy to me that it's normal now to have like 3-4 compilation/transpilation steps when working on a simple JS-based app. This is why I stick with Vue. One tag later you're good to go, and all of the extra stuff (like .vue files) isn't necessary to use the framework. It's a godsend. I can't imagine how many hours I've lost to obscure webpack errors before switching.

What webpack errors are you getting with basic create-react-app?

Any production-destined app is going to have to go through some baseline transpiling, linting and minifying, and CRA really shouldn’t be giving you much trouble with the defaults.

Re: What I wish I knew about React

#24

>> React is a library, not a framework They say it often but it's not true. React forces you into an entire workflow with JSX, bundling, source mapping, babel transpilation and often restricts you to using components that are designed specifically for React; accessing the raw DOM is nasty business. If it was a library, it would not hijack the DOM and override it with its own; that fact alone is more than enough to ca…

You don't need to use JSX in order to use React; it's just syntactic sugar.

https://reactjs.org/docs/react-api.html#createelement

Re: What I wish I knew about React

#25

tldr; React is a view renderer. It renders views. Getting data to and from those views not included. Navigation? Not included. Persistence? Not included. Styling? Not included. Why? It's just a view renderer, that is to say, it renders templates. When the only thing your application shares with its dependencies is its view renderer, you're going to feel a lot of pain. This is one of the big reasons why I use Ember.js…

Except that it's not only a view renderer, it reacts to changes in state, and it has ways to do stateful thing after a component is rendered or stops being rendered or at other times.

And in practice some state is specific to some component or group of components and some state is global or the group of components doesn't translate to a subtree of HTML's tree structure. Also the kind of thing that has to happen based on what happens in the app is often deeply async.

And it all becomes a mess.

But it's still not as bad as a mess as without React, I believe at this moment.

Re: What I wish I knew about React

#26
post #17
post #8

(Opinionated post ahead...) React is, imo, garbage, but alas it's here to stay -- you know, kind of like Spring or Swing. In 10 years we're going to be wondering how the hell we ever used React 8 hours a day way back then. These kinds of markup frameworks/libraries were touted as jQuery's successor, but, from an architectural point of view, jQuery is by far their superior. "Everything an HTML tag" is an insane mantra…

> It's crazy to me that it's normal now to have like 3-4 compilation/transpilation steps when working on a simple JS-based app. This is why I stick with Vue. One tag later you're good to go, and all of the extra stuff (like .vue files) isn't necessary to use the framework. It's a godsend. I can't imagine how many hours I've lost to obscure webpack errors before switching.

You can, of course, do the same with React: https://reactjs.org/docs/add-react-to-a-website.html

Re: What I wish I knew about React

#27
post #17
post #8

(Opinionated post ahead...) React is, imo, garbage, but alas it's here to stay -- you know, kind of like Spring or Swing. In 10 years we're going to be wondering how the hell we ever used React 8 hours a day way back then. These kinds of markup frameworks/libraries were touted as jQuery's successor, but, from an architectural point of view, jQuery is by far their superior. "Everything an HTML tag" is an insane mantra…

> It's crazy to me that it's normal now to have like 3-4 compilation/transpilation steps when working on a simple JS-based app. This is why I stick with Vue. One tag later you're good to go, and all of the extra stuff (like .vue files) isn't necessary to use the framework. It's a godsend. I can't imagine how many hours I've lost to obscure webpack errors before switching.

>> This is why I stick with Vue. One tag later you're good to go, and all of the extra stuff (like .vue files) isn't necessary to use the framework.

You can do this with React

https://reactjs.org/docs/add-react-to-a-website.html

Re: What I wish I knew about React

#28
post #8

(Opinionated post ahead...) React is, imo, garbage, but alas it's here to stay -- you know, kind of like Spring or Swing. In 10 years we're going to be wondering how the hell we ever used React 8 hours a day way back then. These kinds of markup frameworks/libraries were touted as jQuery's successor, but, from an architectural point of view, jQuery is by far their superior. "Everything an HTML tag" is an insane mantra…

Do you have to work with it?

Have you considered getting a different job? (obviously easier before pandemic, but from the sound of it you have been in this boat a while).

Re: What I wish I knew about React

#29
post #8

(Opinionated post ahead...) React is, imo, garbage, but alas it's here to stay -- you know, kind of like Spring or Swing. In 10 years we're going to be wondering how the hell we ever used React 8 hours a day way back then. These kinds of markup frameworks/libraries were touted as jQuery's successor, but, from an architectural point of view, jQuery is by far their superior. "Everything an HTML tag" is an insane mantra…

> simple JS-based app

I’m glad I made it to the end. Why use React for a simple JS-based app when you’re very aware of many reasons you don’t like it for this purpose? If you’re being forced or pressured to by an employer or even the entire job market, that’s not really React’s fault other than for existing.

React (at least many of the features and use cases you mention) is for complex applications and developers that care deeply about the hairy details of user interfaces. (It’s also pretty easy to use without a build step for simpler applications, but that’s another argument.)

Re: What I wish I knew about React

#30
post #8

(Opinionated post ahead...) React is, imo, garbage, but alas it's here to stay -- you know, kind of like Spring or Swing. In 10 years we're going to be wondering how the hell we ever used React 8 hours a day way back then. These kinds of markup frameworks/libraries were touted as jQuery's successor, but, from an architectural point of view, jQuery is by far their superior. "Everything an HTML tag" is an insane mantra…

I personally find “the HTML is a function of its inputs, internal state, and nothing else” to be a much more predictable model for writing large web applications than, “anybody anywhere in your code can pull the rug from under you arbitrarily with jQuery”, and for that alone I prefer the React development experience.

With Hooks I’m happy in that most of the “business logicky” stuff can be split out into those and my components have returned to being pretty much entirely UI code - I don’t really use any of those weird in-between tags like anymore.

Transpilation will happen if you want to use new JS features at all. If you use React without JSX and not using any ES6 features, then you can certainly support old browsers without those transpilation steps - just include the compiled CDN-distributed script in a script tag like jQuery, it’s even advertised in the React getting started docs. Just turns out nobody wants to do that.

I agree that SSR is a crazy story though and I hope someone makes something better - but jQuery doesn’t really help with that at all, bootstrapping state from a different machine than the runtime and not incurring state weirdness/security vulnerabilities seems like a generally difficult problem, not a React-specific one. NextJS (and maybe prerender snapshotting) seems like the only decent options right now.

Post reply on HN