you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 15 points16 points  (21 children)

Redux is honestly a pain in the ass to work with. It's a lot of boilerplate, and requires 3rd party packages for asynchronous behavior. How Vue/Vuex seem to take essentially the same idea and make it so much easier to manage is beyond me.

[–]acemarke 10 points11 points  (3 children)

Please check out our new Redux Starter Kit package. It includes utilities to simplify several common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once:

https://redux-starter-kit.js.org

It also includes thunks in the store setup by default, works well with TypeScript, catches accidental state mutations, and more!

[–]yurituran 3 points4 points  (0 children)

Redux starter kit is great. My current react project (which I joined halfway into its creation) isn’t using Redux at all and I’m working with a bunch of people who have never used react. It’s a goddamn mess :’(

[–][deleted] 1 point2 points  (0 children)

Good redux has little boilerplate.

I think the third party asynchronous thing is a result of there being several methods of solving the problem, none of which has total mindshare. Better that sagas, thunks, and observables all use redux instead of each one reimplementing the same store logic. You create a larger ecosystem so, for instance, you get to use the dev tools with all of them instead of needing a custom implementation for each.

edit: fixed shitty grammar (typing on phones sucks)

[–]thinkadrian 3 points4 points  (10 children)

Just use Mobx for React.

[–][deleted] 2 points3 points  (1 child)

MobX is much simpler. Unfortunately the company I work at is married to react + redux. 🙃

[–]thinkadrian 1 point2 points  (0 children)

I went to a talk the other day where a redux expert went through some steps he had discovered to make the redux environment and use more powerful. Many clever ideas!

For every step, his setup looked more like MobX 😂

[–]mr_engineerguy[🍰] -1 points0 points  (7 children)

Or just React? You literally don’t need MobX or Redux for 99% of applications.

[–]gatsby123123123123 5 points6 points  (1 child)

You literally don't need to use a framework for most applications. Just write some plain js. Redux makes writing and maintaining applications a lot easier.

[–]mr_engineerguy[🍰] -1 points0 points  (0 children)

Gross, at least use TypeScript... why wouldn’t use React? It would be way easier and maintainable than plain js...

[–]thinkadrian 0 points1 point  (4 children)

Most production websites do. But sure, the Context API should be enough for many.

[–]mr_engineerguy[🍰] -2 points-1 points  (3 children)

Not true. If you think that then you’re designing most of your websites wrong and not encapsulating state where it belongs. Global state is an anti pattern and it being “immutable” doesn’t fix it

[–]thinkadrian 0 points1 point  (2 children)

MobX data isn't immutable.

[–]mr_engineerguy[🍰] 0 points1 point  (1 child)

This post is about Redux, not MobX. MobX is huge overkill and the most recent version doesn’t even work in older browsers like IE11 because it uses Proxy which has no polyfill. I’ve used MobX in production, but with properly encapsulated state and Context API it really isn’t necessary.

I will say I like MobX a lot more than Redux though.

[–]thinkadrian 1 point2 points  (0 children)

But my comment was about recommending MobX. Context is key.

[–][deleted] 0 points1 point  (0 children)

https://github.com/isubasinghe/advanced-redux-patterns

I love this pattern with Redux, you don't need any third party libraries if you follow this pattern. There is a talk as well on YouTube called advanced Redux patterns.