Interesting that most people say they'd use React again, but the biggest complain is that it has a clumsy programming model. Anyone got an explanation?
Yeah. "drilled into" felt like a bit of a value judgement, and a bit of a short-sighted one at that.
I still very clearly remember PHP spaghetti code. I don't doubt that a *lot* of PHP is still written like that now. I don't want to re-live that.
Consider Vue. Single-file components with your HTML, CSS, and JS in there. Yet somehow it manages to achieve a separation of concern that JSX seems to really discourage.
I've tried so hard to like React, like one of the cool kids. I'll take Vue over it any day of the week, even though they are 75% the same framework.
I'm just about to take a React course online and was debating between Angular or React.
A lot of things I read online seems to say React is easier to learn and can do what Angular does. Reading descriptions here of React and the general way it works is starting to make me nervous.
Being a backend developer with C# and Java, Typescript was an attractive bonus with Angular.
Not sure what direction to start on, with all these JS frameworks out there.
I've heard that React was created because of the influx of backend devs into the front end. Personally I find that React maps better to coding because nested components become more like nested functions.
If you know C# and Java I think Angular will suit you more since it actually looks somewhat like Spring Framework.
But ... why not learn both ... each have their own pro's and cons so it's better to find out which of the two is better for you.
Trying to get to a decision based on Reddit opinions will likely get you to choose nothing because there's always someone having a something against framework X or Y or language Z ... usually without any real argument ;)
Right? I'm seeing this as mostly programmers bored of/against structure and wanting to have "interesting" work, which really means reinventing the wheel.
The few React guys I've known;
have invented their own framework on top
have told me they want to do "interesting" work
forgo any standards and write whatever the fuck comes to their mind
Needless to say while it's worse than any backend framework I've ever used, Angular+Material is still my preferred stack. It constraints developers to a standard, opinionated, way of doing things as much as it can. I've also heard good things about Vue but had no chance to experiment with it.
I also lived through PHP and JQuery spaghetti. Never again.
JSX is wrong, but it's almost a feature by design. It forces you to write small components to keep the JSX under control.
It's like 90% a good thing, but deadlines and migrating legacy code to React do happen in the real world. And when you do end up with a a large-ish component JSX becomes a serious pain.
I kind of agree with you. It is 'wrong', and that's why it's so good.
The old fashioned way of web development (and GUIs in general) was to keep HTML, JS, and CSS, as totally distinct things. CSS Zen Garden being the epitome where entirely different designs are pluggable. In practice this is a waste of time. It's like when people design their SQL to be DB agnostic, and yet only ever run it on Postgres.
You end up with a lot of drift. It's common that people are only ever adding to a CSS file and never removing. I worked on a redesign for a site and we ended up loading both old and new design as about 10% of the old CSS was still used in random places. So users were getting this massive CSS file they just didn't need.
JSX helps to solve these issues. It keeps everything in one place and that way when we remove a component, we remove everything. If I rewrite a component all of the CSS is small and manageable.
Now people may chime in and say you can do it the non-JSX way and keep it manageable. They are right. But it requires a lot of self-discipline. It's a little like saying "just don't write any bugs". It's much better to have a structure that encourages keeping things manageable by design than manageable through self discipline.
100% agree with this. I remember trying to write even small/medium-sized web apps with just HTML, CSS, JS, and some Jquery. If I didn't actively make sure that I meticulously organized my code, it got out of hand in a second. However, with React/React Native projects, having JSX components makes it insanely easy to stay organized. I do agree that large components are hard to handle, but they are way easier to handle than a bunch of disconnected JS files and some HTML where you're never sure what does what. At least a react component keeps logic for one thing in one place.
It takes a declarative language (html) and turns it into something that has big parts that aren't declarative. It's has syntax that is just ugly to see in a javascript file, all those {} and <> mixed in there. hacks like 'condition && <div>' are common. And at the end of the day your "logic file" has in the same file a lot of things that aren't logic related.
All those issues are minimized when you write small React components, and overall I prefer it to the alternatives, never wrote otherwise. But looking it plainly from a non-pragmatic perspective, it violates a lot of principles.
Are you suggesting that it's a bad idea to be able to render presentation logic in the same language as your business logic? Or do you just have a problem in inline HTML inside of javascript? I personally hate JS in general, and I don't particularly like JSX either, but I'm definitely not against internal DSLs being used to render views (as opposed to a special templating language).
Separation of view/business logic is really a separate concern in my opinion, but it's good that some templating engines enforce this.
I think this can definitely be true. However, I do think that you can very easily separate business logic from your react components. I think in principle, a react component is about being a function that, given data, deterministically returns a view. If you keep your logic in other libraries/helper files, and use state tools like redux-saga, you can pretty easily separate business logic from views. Of course, there is still some logic in your components, but that is because views often need to have some logic in them. (For example, something like shouldShowSearch: boolean, which conditionally hides or shows a search bar in your component.)
55
u/dpash Nov 19 '18
Interesting that most people say they'd use React again, but the biggest complain is that it has a clumsy programming model. Anyone got an explanation?