Relevant Package
This would probably be a new package, called @ngxs/component or @ngxs/component-store
Description
Currently, it doesn't seem possible to manage state at the component level.
In other words, this would be a store with a lifecycle that matches a component's lifecycle, while being independent from the global store.
Describe the problem you are trying to solve
I was managing the state of a component using the shared store. I realized I will need more than one instance of this component to be rendered at some point. However, they cannot share the same store: they each need their own store to write and read from. So they need to manage their states locally.
Describe the solution you'd like
Something like @ngrx/component-store. That is, a Store component that can be created -- with all the reducers and selectors -- and then be injected into a component that wants to use it, so this component can initialize it and pass it around as needed.
Describe alternatives you've considered
I've considered:
Despite there being working alternatives, a solution with the NGXS philosophy would be better. After all, NGXS exists because it's a better/more modern alternative to NGRX.
Relevant Package
This would probably be a new package, called @ngxs/component or @ngxs/component-store
Description
Currently, it doesn't seem possible to manage state at the component level.
In other words, this would be a store with a lifecycle that matches a component's lifecycle, while being independent from the global store.
Describe the problem you are trying to solve
I was managing the state of a component using the shared store. I realized I will need more than one instance of this component to be rendered at some point. However, they cannot share the same store: they each need their own store to write and read from. So they need to manage their states locally.
Describe the solution you'd like
Something like @ngrx/component-store. That is, a Store component that can be created -- with all the reducers and selectors -- and then be injected into a component that wants to use it, so this component can initialize it and pass it around as needed.
Describe alternatives you've considered
I've considered:
Despite there being working alternatives, a solution with the NGXS philosophy would be better. After all, NGXS exists because it's a better/more modern alternative to NGRX.