Hacker News new | past | comments | ask | show | jobs | submit login

Modern redux is okay, the first redux was just an abomination of boilerplate code, that gave frontend developers the feeling they are doing „clean architecture“ now too…



I mostly have to work without RTK, and I still prefer that old Redux over anything else. The boilerplate is mostly just thinking clearly about state changes, and if you avoid that too much (in any framework) you get into trouble.


Whenever I see less experienced developers writing Redux, the result is just an abomination of chaos. I prefer naive spaghetti code over redux, because I can easily rewrite that into good code. But if the logic for one operation is distributed across dozens of files, it gets really hard to refactor.

And mediocre developers are the reality, i don’t think there are many teams, where everyone writes awesome code all the time.


I can't agree. I've never worked with people that don't understand a convention like "put actions in actions.ts and selectors in selectors.ts". Nor is that really a big deal because Redux is very easy to refactor, it's just pure functions.


Sure, they do that. But what do I do with a 5000 lines of actions and selectors that are all used somewhere, are all named somehow similar/unclear and only work in a specific combination/order, nobody remembers anymore?


Actually with redux it is trivial to record, replay, even filter actions.

That's one reason I like redux so much. I expect this functionality from any other state management solutions I encounter. Some others indeed do have this.


Do your job? I mean if it is that complicated, it has to have some purpose and value behind it, also you wouldn't be hired or tasked to improve it. With redux there is a good chance the actions and state are at least very transparent, for example when using the devtools.

In my experience it's a lot harder to deal with mutable state in some context provider or something.


@reduxjs/toolkit is absolved most, if not all, of the boilerplate. It's been a joy to use.


Yeah, it got much better now.

But since react query and swr I think most applications don’t need state management anymore.

If you have complex state, it makes sense. But just to fetch/refetch some queries redux is overkill.

Most redux (and also angular ngrx/ngxs) projects I’ve seen, are just over engineered. They solve an easy task in a very complicated way.


I find using query/rtk/etc to be more trouble than they're worth tbh. It's more black-boxing then I'm comfortable with, personally. I want my side effects explicit. I've found a lot of success with redux/redux-observable which is super clean, at least for me.


Okay, for me the functionality of those libraries is quite straight forward. You can just turn on/off whatever you need with one setting.

But usually the defaults is what you want. Your user is on a bad connection? Automatic retries are what you get and what the user needs. You user just got back online? React query notices that event and refetches the failed queries.

You need all those features turned off? Just turn them off in the config object.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: