Live data from Hacker News

My struggle to learn React

bradfrost.com

121–130 of 218 posts

Re: My struggle to learn React

#121

I think I can understand the struggle of the author. I experienced JS as a non-robust / fast-moving programming environment. Frameworks, Buildsystems and Language Features that change every few month. So when I first heard, that React is the new thing and everyone should use it, I did not want to use it. I use React now everyday and I really like it. But instead of writing it with JavaScript I use ClojureScript with…

> and Language Features that change every few month

On the other hand, there was a period where JS devs could use one new language feature in a decade. And when it did come, it was ActiveX. (I'm exaggerating, but not by much.) From this perspective, it was kind of inevitable that at some point JS will overdo this and become a kitchen sink.

I tried using ClojureScript in its early days, but the JVM ecosystem was painful. I don't see a point in having very similar, but not 100% compatible languages on backend and frontend. Either you use the same language, or two different languages, in which case you can as well use something you like more on the backend.

Some time ago (a year or two, I think?) CLJS got bootstrapped - is it finally possible (and practical) to use with node only?

Re: My struggle to learn React

#122
It appears that the biggest argument for React is:Facebook is using it. Really? PHP folks say they same thing: FaceBook is using PHP. There is article on how they write a custom PHP in C. When I view source of FB, it looks like SSR - and they are not using node.

Maybe some small notification widget is sprinkled on top of PHP.

But what kind of argument is: FB is using it? What is the FB reputation even?

It is: who cares. My POV is, show me a react project, and I'll show you a poor tech manager. Because react and js frameworks are so much worse than LAMP even. The productivity is shit. The maintenance is: lets re-write it. Etc. etc. The point is not to program, but to solve business issues, ex: SEO, user engagement, etc. Best thing you can do as a manger: get the react programmer to work for your competitor, that is a win.

Re: My struggle to learn React

#123
post #19

Honestly I don't know how I learned React. It's not fun at all. Oh sure, the basics of React is not too hard. If you ignore all the outdated examples and code (using var, no JSX, overusing component lifecycle, not using functional components). But then learning Redux, React Router, React JSS, Reselect, Redux Thunk, Webpack, etc., is just terrible. Sure, there are tutorials for each individual library, or maybe even t…

So don't use Redux, React Router, and Thunks. I don't even know what React JSS is. Use create-react-app's tooling. Even Redux's author tells people Redux is overused. A pretty big percentage of the value of the flux pattern is just in having an event pubsub system, so if your application is so complicated that you really feel like you need to structure it, you can just use EventEmitter. I frankly don't understand the…

> Even Redux's author tells people Redux is overused.

I believe this is the post [0] in question.

[0]: https://medium.com/@dan_abramov/you-might-not-need-redux-be4...

Re: My struggle to learn React

#124
post #91
post #69

Earlier quoted context omitted.

Let me add a different point of view. The adoption of React in the world of ClojureScript was pretty much instantaneous and total. I don't think anybody writes ClojureScript webapps in any other way these days. But the way React is used is different: it's used as a smarter mapping from application state to DOM. Clojure and ClojureScript programmers already know how to manage state and limit its spread, React (plus th…

Do you have any links/resources for using React with ClojureScript?

There are a couple Clojurescript interfaces to React: Om (https://github.com/omcljs/om) and Reagent (https://reagent-project.github.io/) are two I'm familiar with.

For an example of how a Clojurescript project would be built using these libraries, I'd recommend checking out re-frame: https://github.com/Day8/re-frame

Re: My struggle to learn React

#125
post #19

Honestly I don't know how I learned React. It's not fun at all. Oh sure, the basics of React is not too hard. If you ignore all the outdated examples and code (using var, no JSX, overusing component lifecycle, not using functional components). But then learning Redux, React Router, React JSS, Reselect, Redux Thunk, Webpack, etc., is just terrible. Sure, there are tutorials for each individual library, or maybe even t…

So don't use Redux, React Router, and Thunks. I don't even know what React JSS is. Use create-react-app's tooling. Even Redux's author tells people Redux is overused. A pretty big percentage of the value of the flux pattern is just in having an event pubsub system, so if your application is so complicated that you really feel like you need to structure it, you can just use EventEmitter. I frankly don't understand the…

You're not wrong for beginners. They shouldn't use all or any of these tools starting out. But when you reach the point where you understand React and you start to reach the limits of React's features, i.e. inline styles isn't cutting it anymore, setState is growing too big and too complex, etc., that's when it starts to get hairy. Because continuing down the path of pure React is painful, but learning all these damn libraries is also painful. That's where a lot of people get lost imo.

Not to mention the times where the codebase predates you. My first experience with React was on a codebase that was pretty horribly managed. Basically a combination of magpie developers and a total lack of understanding of React patterns. When the developers are finding and trying to integrate the next new shiny lib every other week, it becomes a nightmare for any new developers.

Re: My struggle to learn React

#126
post #87

Earlier quoted context omitted.

Like Java/Spring. Why do not use a more simple approach, say jQuery?

Why use jQuery when the native document.querySelector/querySelectorAll methods are available everywhere these days?

Cross browser/backward compatibility, especially IE...

Re: My struggle to learn React

#127
post #19

Earlier quoted context omitted.

So don't use Redux, React Router, and Thunks. I don't even know what React JSS is. Use create-react-app's tooling. Even Redux's author tells people Redux is overused. A pretty big percentage of the value of the flux pattern is just in having an event pubsub system, so if your application is so complicated that you really feel like you need to structure it, you can just use EventEmitter. I frankly don't understand the…

I mean this in a nice way, I'd really appreciate a gist showing how you get the core concept of react-router in 50 lines. It's in a project of mine now and maybe it shouldn't be.

This is a great talk by Ryan Florence (one of the creators of React Router) where he basically reimplements the basics of the library from scratch: https://www.youtube.com/watch?v=wPJxmZx62gI

I'd also just look at the React Router codebase. The components are pretty well written and somewhat easy to understand: https://github.com/ReactTraining/react-router/blob/master/pa...

Re: My struggle to learn React

#128
I don't know that non-programmers should or need to learn react.

I understand that for employment - front-end devs need to learn react. I just question if websites have finally become more app-like, and hence require app-developers, not front-end developers.

They're two separate skills, and one cannot easily go from one to the other, nor should one expect it to be a smooth transition.

Re: My struggle to learn React

#129
post #19

Earlier quoted context omitted.

So don't use Redux, React Router, and Thunks. I don't even know what React JSS is. Use create-react-app's tooling. Even Redux's author tells people Redux is overused. A pretty big percentage of the value of the flux pattern is just in having an event pubsub system, so if your application is so complicated that you really feel like you need to structure it, you can just use EventEmitter. I frankly don't understand the…

You're not wrong for beginners. They shouldn't use all or any of these tools starting out. But when you reach the point where you understand React and you start to reach the limits of React's features, i.e. inline styles isn't cutting it anymore, setState is growing too big and too complex, etc., that's when it starts to get hairy. Because continuing down the path of pure React is painful, but learning all these damn…

I think far more people get lost trying to learn the libraries than grow an app to a size where pure react too painful.

First time I used react I hated it, because everything was done through flux, want to add a field to a form. Now you need to update 4 different files and create 8 methods. Not to mention interacting with non-react components in a react way can be super painful.

It was insane. Second time I dropped all of the libraries. Only used react, and any time I needed to use a non-react component I wrapped it myself, and many times did very unreacty things like use methods to do a lot of interaction.

And I loved it. Everything is so much easier. I can focus on solving the user's problems, and not my react problem.

The apps weren't huge, but they weren't small either. 3 months of work for 3 devs full time.

Re: My struggle to learn React

#130

The people who will learn React the quickest are those who have been building applications on other platforms beyond the web.

I think it is worth learning Elm first because it many ways it is much simpler. No JS "this" issues to worry about. No props vs. state. It is very opinionated. But it is also virtual dom and "component based" so the paradigm is instilled in the brain to go across and learn React.

Disclosure: I learned some Haskell before Elm so I may be "immunized" against some of the struggle!

Post reply on HN