DEV Community 👩‍💻👨‍💻

Cover image for State management made simple - with Angular use case
Santosh Vaza
Santosh Vaza

Posted on

State management made simple - with Angular use case

Managing state in an application can sometime become a complex problem, especially when there is a requirement to perform an action when data changes overtime. An action can be as simple as updating a UI component when it happens.

What basic functionalities do we expect from a state management lib ?

  • centrally managing the state
  • get notified whenever data changes
  • no memory leaks and performance problems
  • manage state over different channels (memory, sessionStorage, localStorage)

DataStore library does that all. Right now only MemoryStore is supported, however this should fulfill all the needs of a webapp today. The readme for the library is self explanatory, so I will not post it here.

Library is a pure javascript library, so it can be used in any javascript platform or web frameworks like react, angular, vuejs.

It currently has a full blown example use case in angular that you would like to check out.

Initially when i developed it a year back, i was required to replicate it in all my projects by copying the source all over. Few days back i just thought of creating an npm package and make it available to community as well. This is where we all can collaborate and share ideas about improving it.

In case if you have any questions, pls do reach out to me.

Top comments (0)

🤯

"I made 10x faster JSON.stringify() functions, even type safe"

☝️ Must read for JS devs