DEV Community

Discussion on: State Management with NGRX - Introduction

Collapse
 
ky1e_s profile image
Kyle Stephens

Nice tutorial. Much more detailed than many NgRx tutorials I have come across.

One point to note:

A state-management solution, be it a library or your own implementation, should always be preferred to local state.

I would hesitate to be so prescriptive.

Dan Abramov, creator of Redux, notes that you might not need Redux for every application - You Might Not Need Redux

Quote:

Redux offers a tradeoff. It asks you to:

  • Describe application state as plain objects and arrays.
  • Describe changes in the system as plain objects.
  • Describe the logic for handling changes as pure functions.

None of these limitations are required to build an app, with or without React. In fact these are pretty strong constraints, and you should think carefully before adopting them even in parts of your app.

Collapse
 
gc_psk profile image
Giancarlo Buomprisco

Hi, thanks a lot for your comment!

I totally agree with you, my statement should clarify better what I meant.

There are some parts where I found global state to be way overkill for what I was trying to do, for example: transient state and forms.

Notice also: I don't think Redux is the answer to everything, nor the sentence fully states such a thing. I just think that every application should try to adhere to a form of state management and stick to it.

If Redux is taken out of the equation, I think using services powered by Rx with Subjects would be a very good idea.