Live data from Hacker News

React and Redux are a joke right?

games.greggman.com

111–119 of 119 posts

Re: React and Redux are a joke right?

#111
post #110
post #108

I agree that there is some amount of boiler plate code to Redux that doesn't seem to make sense and takes a long time to do when you're new. But I think it really helps with maintenance and scalability of projects down the road and saves you time later on. Of course, as others have said, React and Redux is not a panacea - depending on what you want to achieve and on your personal preferences there might be better too…

> I think it really helps with maintenance and scalability of > projects down the road and saves you time later on. It's popular argument but I don't think it's completely correct. On the one hand principles of Redux (immutability, message-passing approach, separation model from the view) can be helpful, on the other hand huge amount of boilerplate and moving parts can only spoil scalability. Besides Redux is very lo…

I see your points and don't disagree. However, Redux is a fairly young concept and I think it has some potential to grow (as is React).

Re: React and Redux are a joke right?

#112

The article has a point. We tend to fix issues with state by avoiding mutability. That is like going to a doctor because it hurts when you laugh, and they just say "don't laugh". I wish there was a language that embraced mutability instead [1]. Mutability is how the computer works at the lowest levels, and how we tend to think about the world. You would use plain old data objects to store everything. Then you would h…

> I wish there was a language that embraced mutability instead

IMHO Rust manages to do this really well - the system of ownership and borrowing brings all the safety of immutability to mutable data. Check out the "Why Rust" video: http://intorust.com/

It's not really viable to use in place of JS yet (only via Emscripten, which results in a huge bundle) but the future looks bright for Rust.

Re: React and Redux are a joke right?

#113

I started working on a react native+redux project myself recently (after working with react on its own for about 1 year) and have been feeling the same way. And we've just been working on auth, data persistence, and screen navigation. My problem with it is that there is so much abstraction that almost no prior knowledge from using other frameworks or libraries is useful. It seems like everything is magic. Here is a c…

This is exactly my experience. Eventually, I skipped redux/mobx/etc altogether by creating a singleton EventEmitter which can hold application state objects, emit events when the state changes and persist it to SQLite. For data that does not need to be in memory, I just access SQLite directly (and I can still use my appState singleton to let the rest of the app know when SQLite data has changed.) Yesterday I spent pr…

Just an update: I almost gave up on react-native today because the navigation story seemed so broken. I actually spent a few hours checking out Xamarin.Forms at one point. Then I took a break and I was about to play some Rocket League when I had a eureka moment - I finally understood the simplest way to make react-navigation work the way I needed it to and within an hour I had a working implementation!

(The trick that worked for me: Don't nest navigators directly within each other, instead wrap each one in a component class, get a ref to the wrapped navigator and then use that ref to handle navigation requests from a global navigation service that other components and services can use.)

So, my opinion of react-native has softened a bit this evening as I've gotten over my biggest hurdle yet. After trying Xamarin out and also comparing it with my previous Ionic/Cordova/PhoneGap experience...I'm glad to be back with react-native.

Also, Expo XDE has been a pleasure to work with - discovery of that tool is the reason I decided to re-investigate RN about 2 weeks ago. The first time I tried RN was like 6 months ago and I had spent a few days the first week just trying to get the environment working properly. This time everything just worked (and on multiple operating systems!)

Re: React and Redux are a joke right?

#114

Earlier quoted context omitted.

"there are no immutable primitives" Many array prototype functions work in an immutable way like map and reduce

Updating an array element arr[3] = 'New content'; Updating an array element immutably arr = arr.map((element, index) => { if (index === 3) return 'New content'; return element; }); It's possible, sure, but it feels terrible. JavaScript objects want to be mutated - it's the most idiomatic way of interacting with them. Whether functional programming paradigm is good (I certainly feel it is) is beside the point - JS was…

I know your point wasn't strictly pertaining to boilerplate, but for an apples-to-apples comparison, the most succinct way to change a member of an array immutably would be something like:

  arr = arr.map((e,i) => i === 3 ? 'new content' : e)
That said, idiomatic or not, functional patterns in JS are a boon for debugging (especially with Redux devtools & time travel). To your example, even if mutability is more succinct, using map() lets me chain all sorts of methods together without storing intermediate values in vars.

Between the spread operator (...), immutable array methods (slice, reduce, map, filter, and even sort if preceded by .slice()), immutability in native JS ain't half bad.

Re: React and Redux are a joke right?

#115
post #3

Stopped reading half-way through, as lots of incorrect stuff off the bat. > In the react world though you can’t mutate your data Sure you can. > If you get 3 people react will end up re-rendering 3 times because of the code above. Each call to `setState` triggers a re-render. Nope, calls to setState are batched.

I think sometimes you need an outsider view to call out that the emperor isn't wearing any clothes, and that's going to result in botched details. I don't think it impacts the overall point the author is trying to make. I teach web development at a part-time course, and we recently redesigned our curriculum to use React + Node instead of Rails with JQuery. With the new technologies, the students are profoundly less p…

I'm a Django guy and I still feel that the ascent of Django and Rails was the high-point of productivity in web development.

I still advocate for "progressive enhancement" as a development philosophy but the javascript kids seem to have taken over the show and regard back-end code as there for nothing more than building an API.

For the vast majority of javascript use-cases Turbolinks/PJAX gives you most of the benefit of a client-side framework (which usually boils down to faster response times by avoiding full page loads with the advantage that you get to keep most of your logic in nice server-side languages with non-pathological ecosystems.

Also see http://intercoolerjs.org/ - which follows a similar philosophy.

Re: React and Redux are a joke right?

#116
After reading so much about it and trying it several times, I think my problem with react (alongside the licensing issue anyway) is that it feels like the perfect example of the fundamental theorem of SE: Everything is full of indirections and, when that isn't enough, then more abstractions in the form of tangentially related libraries (such as immutablejs in this thread) are recommended.

I'm sticking with Vue, it's not perfect but it was at least designed to play with js's strengths instead of abstracting them to shoehorn functional principles.

Re: React and Redux are a joke right?

#117

Earlier quoted context omitted.

Are you implying then that the Closure Compiler mitigates or even eliminates the need to carefully examine the output sizes because of its optimization capabilities? If so, that's great, but I do remain skeptical about this, based partly on my experience described above. I don't mean this in a sarcastic or dismissive way but I was expecting to see something along the lines of: console.log("Hello world!") I realize th…

Clojurescript's bundle size for real world apps is decent, especially given the power it provides. If all you're doing is a 3 line JavaScript, Clojurescript won't benefit you. But if you're writing a complex application,it will beat or match your typical JS stack in terms of code size. I suggest watching this: https://m.youtube.com/watch?v=gsffg5xxFQI

Thanks for the link.

Re: React and Redux are a joke right?

#118
post #15

>In the react world though you can’t mutate your data. Wrong, you're free to mutate your data. What's immutable is the virtual DOM fragment that a component maps the data onto. If you want to manipulate the DOM directly (and it can make sense), how about not choosing a virtual DOM/diffing library? >If you get 3 people react will end up re-rendering 3 times because of the code above. Yeah, because the code above is ob…

I'm about 6 months into a React project (coming from Angular1) and honestly I find the OP's rant pretty coherent. React requires a preposterous amount of code to maintain state, and Redux doubles down on boilerplate. In Angular-land you can just mutate some JS objects and the UI magically updates. I really miss that. I picked React over Angular2 because the setup was simpler and I wanted to try out this new thing tha…

No matter what framework or library you choose, if you go past the to-do list project you will encounter certain pain points. I worked with jQuery when it was the new kid on the block, with Angular since it first came out and now with React. Every one of them gives you grief now and again. However if you develop pragmatically you learn how to avoid those pain points early on in the process even if it means investing some time. It will pay off later on. And if there is absolutely no way to mitigate the pain - just move on to another library.

It makes me sad to see people ranting about how much typing there is in Redux or Typescript or how much boilerplate and so forth. To me this behaviour screams immaturity, because I don't know how else to explain spending energy on wining instead of finding a solution. Especially, that you don't need to look far - take redux-actions for example. Nice and simple, makes all the heavy lifting for you. If that's not cool in your view how about you actually contribute and write something of your own, rather than moan?

Re: React and Redux are a joke right?

#119

Earlier quoted context omitted.

I think sometimes you need an outsider view to call out that the emperor isn't wearing any clothes, and that's going to result in botched details. I don't think it impacts the overall point the author is trying to make. I teach web development at a part-time course, and we recently redesigned our curriculum to use React + Node instead of Rails with JQuery. With the new technologies, the students are profoundly less p…

I'm a Django guy and I still feel that the ascent of Django and Rails was the high-point of productivity in web development. I still advocate for "progressive enhancement" as a development philosophy but the javascript kids seem to have taken over the show and regard back-end code as there for nothing more than building an API. For the vast majority of javascript use-cases Turbolinks/PJAX gives you most of the benefi…

> but the javascript kids

> with non-pathological ecosystems.

That's just like, your opinion, man.

Post reply on HN