I want JavaScript state management
Submitted by Gary Valverde Hampton
Permalink https://webwewant.fyi/wants/88/
I would like a way to manage state across JavaScript features (specially native web components) without depending on Redux or similar technologies (ngrx, ngxs, Akita, Mobx). On the community side, we've been developing a lot of tools and libraries that allow us to manage state and I think we’ve reached a mature-enough state to start looking for a native implementation to this pattern.
Without state management, it's pretty easy to lose track of the local state in applications with multiple components. Facebook addressed this using the Flux pattern (video).
Here’s what we need in a state management implementation:
- Capable of handling API transactions with the Observable Pattern, so different sections of the application can listen to changes (currently we have Observables, stage 1).
- A way to manage the store structure dynamically (lazy loading) with local and custom data types, perhaps in a Graph format to handle circular references between Abstract Concepts.
- A way to bind attributes and events to such state management in order for sections (specially native web components) to be able to read and write changes into the store, triggering other sections to update.
- Some persistence API (Indexed DB?) so the state can be easily shared between multiple instances of a website.
- An integration with Web Sockets so external APIs or other data sources could notify changes into the create state management, this notification could be handled as a subscription to such data source on each node of the types Graph.