Why should I use Redux in React aside from its beautiful chrome extension? For job purposes only?

I think RxJs and React context API + hooks can do the same job with less codes.

Also, there are a lot of developers who don't like Redux.

Convince me to use Redux

  • 1
  • 3
    Redux is just one state manager.

    Hooks is partly state management.

    Context isa built in building block for state handling.

    Unless you have decided to use redux there is nothing forcing you to use it and there are many newer, and in my opinion easier to use, state management solutions.

    Hooks + context goes a long way unless you plan to use a lot of centralized business rules in state.

    Mobx is one I liked a lot but currently hooks is sufficient:)
  • 1
    Just don’t use redux... I found that even for times where you want to have special business logic in your state, you can get away with doing it in hooks (like writing your own custom hooks for auth or API).
  • 0
    Not much of a front end developer here but doesnt redux also stores the state in the localStorage and manages it?

    Would you manage your localStorage state in each hook of every component you write?
  • 0
    @Voxera well my company forces me to use it though.
  • 2
    Don't use redux. Two companies in a row spent 3-4 months removing it with every little thing going wrong at every turn.
  • 2
    Just don't use it. Redux sucks, it's a lot of boilerplate to do simple tasks. Hooks and Context do pretty much the same thing in a much better way
  • 0
    Well, if you're religious then the god object might appeal to you. Although manually creating a god isn't part of most religions that I'm aware of.
  • 2
    Redux is too much work. You need middleware, action creators, and creators of action creators
  • 3
    @Devnergy well, unfortunately that is one pressning reason :/

    The reason many avoid it is thats its a lot of boiler plate and its also rather disconnected so its not always easy to follow what is happening.
    With good documentation it can work.

    But the company I work for started using it a couple of years ago and are now moving away from it because its not worth the extra work needed.

    But done right it still gets the work done.

    But if its company policy the only way would be to convince some one with the power to change policy and that usually involved proving that a change would save or make more money.

    And since a change always has some transition cost its not a given that it is the right business decision.
  • 0
    @bioDan so no. By default redux will not sync with any cookies/localstorage etc.
    You should setup hooks for this (in fact lots of existing libraries that would do this for you, but it’s dead simple to do yourself)
  • 0
    @Voxera I agree. We will start a project from scratch and the tech lead chose Redux for the global state management. I'm not sure if he likes it, don't know the cons, don't know RxJs/Hooks + Context API or Redux is the only global state management he know. I don't want to contradict his tech stack since he's the tech lead.

    RxJs or Hooks + Context API is much better than Redux.
  • 0
    @Devnergy what you know is almost alway better than something you don’t know. And if you have lots of existing code or structures you plan to reuse it can also be a factor.

    But I would recommend that unless you already know hooks and context that you experiment with it on your own time to learn.

    That way you improve your knowledge and once you know it good, its easier to take it up with the tech lead, possibly just the two of you to avoid prestige to be to much of a factor.

    Unless you plan to try to replace him, let it be him who takes the idea to the rest of the team, that way he can keep the lead role ;)
Add Comment