Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we need store for all api #23

Open
ajitsinghkaler opened this issue Aug 20, 2021 · 3 comments
Open

Do we need store for all api #23

ajitsinghkaler opened this issue Aug 20, 2021 · 3 comments

Comments

@ajitsinghkaler
Copy link
Owner

In this repo we are adding store for all API but do we need to add that. The data is not reused you can directly call the api and it should work. why add a store layer

@fyodorio
Copy link

Store is a kinda opinionated mental model. And not a bad one. It allows to separate concerns of actions (or updaters in this case, as you use Component Store), effects (which aren't just server events but also modal windows, error catching, logging, and other side stuff), and observable selectors, which can be reused widely (with memoization, that's important) instead of creating new subjects (or anything similar) in each API consuming component.

So if you like such approach (I mean, you started to use it from the beginning, hadn't you) it's great to stick with this solid, well-documented and well-tested solution.

But it's definitely up to you (and/or other maintainers).

@ajitsinghkaler
Copy link
Owner Author

Yeah but as I'm using it I think I use the API one time. Te store is used for nothing. We need store if we are reusing data in some way but I'm fetching data once showing it once. So, I'm starting to feel I need not store it in anyway. Component store is a service with a subject. I would not have even used service with a subject for all this

@fyodorio
Copy link

Well that makes sense. Anyway, if you don't see any use of the stores in future and you feel much more comfortable without them, why not get rid of it. It's always the matter of personal preference. I personally agree with an opinion of a great guy Armen Vardanyan who says something like "if an application is large enough for Angular, it's large enough for NgRx" 😄

In this case it's not the question of size but rather a tool choice though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants