Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've never understood why redux gets implemented so badly... I feel that the folks who build wacky redux implementations would still write spaghetti managing state without redux.


The biggest issue is that for the first few years there was no single standardized way to write Redux code. Everyone came up with their own patterns, and wrote their own helper libraries. It also required a lot of "boilerplate" code for things like defining action type strings, action creator functions, and hand-written immutable updates.

That's why we published our official Redux Toolkit package in 2019. It standardizes Redux usage, and includes methods that build in our recommended approaches for things like store setup, writing reducers, simpler immutable updates with Immer, and even a complete server data fetching and caching solution called RTK Query:

- https://redux.js.org/introduction/why-rtk-is-redux-today

- https://redux.js.org/tutorials/essentials/part-2-app-structu...

We routinely get highly positive feedback from folks who hated writing old-style Redux, but love using RTK.

Related, we also have a "Style Guide" docs page that provides guidance on what approaches we recommend using when writing Redux code:

- https://redux.js.org/style-guide/


Having used RTK and RTKQ, I cannot believe they come from the same authors. RTK is mostly serviceable, though for most projects, not using Redux is better. I’ve never seen a case when RTKQ was an improvement over fetch().

Obviously, deleting Redux from the internet to prevent incompetent engineering leads / managers from forcing it on people would be preferable.


If you can't understand the benefits of using RTK Query over fetch I'm not sure you're credible.

They're not even substitutes; RTK Query by default wraps fetch or can be configured to use your preferred http client. So it's an entirely additional layer of cacheing and refetching logic with a standardized interface around common loading and error states.

It is considerably easier to write performant web applications with a library like RTK Query or TanStack Query than to just use fetch and try to roll your own cacheing solution. I say this as someone who has done all of the above professionally.


In my experience it was due to backend devs (like myself) being asked to or volunteering for some front end projects. At least that is how our current frontend turned into a redux mess and is currently being rewritten.

It is a completely different skillset and I think more often than not people assume that they can write front end code just because they know Javascript.


Redux is very straightforward until you start adding middleware, then the complexities start piling up.




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

Search: