6

I don't like React Redux. Big and lots of boilerplate code just to get working. I prefer RxJs and Context API.

But between Context and RxJs, I will choose RxJs for global state management

Comments
  • 2
    I tried context as a way for components to read and use the same state without having to throw them around as props. It didn’t work out bc I ended up with re renders that I didn’t want happening (bc components re render when the state they subscribe to changes) and fixing it would’ve required more complex logic. Like if i had component a and b and they’re both subscribed to state c, I would have component a and b rerender when c changes when I only want component a to.
  • 0
    RxJs was brought to me before. Does it allow you to prevent unwanted re renders of components that share state? It’s hard to break up components in react and have them use the same data without context or redux, both of which would force re renders when the state is changed. It’s so annoying!
  • 1
    @d-fanelli yes. Only components subscribed to an observable will re render. Observables can be in multiple service files
  • 0
    @Devnergy thanks. It seems sharing state can be risky business (AT TIMES) bc components re rendering can have unexpected consequences and bugs. Maybe that’s where redux is handy? A Component a can affect component b by dispatching to a reducer and that reducer can return a state that only component b consumes. Redux has been stressing me out for a few days bc it’s been hard to see its point
Add Comment