admin管理员组文章数量:1278653
Wondering why one would use NGRX or NGXS for an Angular app instead of constructor injected services to handle ponent IO?
Is it only to ensure that ponent properties references are never mutated without switching out the entire property value reference or is there more to it?
Altnernative to NGRX
per the answer I developed:
Slice.
I believe it does everything NgRx / NgXS does (With the exception of a time machine - but this is easy to implement via delta notifications - already supported). but with zero boilerplate.
Here's an article showcasing some of the capabilities: /@ole.ersoy/storing-users-in-the-reactive-slice-object-store-5ea0fab06256
Wondering why one would use NGRX or NGXS for an Angular app instead of constructor injected services to handle ponent IO?
Is it only to ensure that ponent properties references are never mutated without switching out the entire property value reference or is there more to it?
Altnernative to NGRX
per the answer I developed:
Slice.
I believe it does everything NgRx / NgXS does (With the exception of a time machine - but this is easy to implement via delta notifications - already supported). but with zero boilerplate.
Here's an article showcasing some of the capabilities: https://medium./@ole.ersoy/storing-users-in-the-reactive-slice-object-store-5ea0fab06256
Share Improve this question edited Dec 13, 2018 at 17:29 Ole asked Apr 17, 2018 at 18:43 OleOle 47.2k70 gold badges237 silver badges443 bronze badges1 Answer
Reset to default 13You will need to write a service that provides a consistent and easy to change api to modify the data, you will need to e up with a fast and well tested way of querying the data, you will need to write and maintain observables for all your data. You will have to write and establish a pattern for async calls. You will have to write an api to access the data in your templates.
By the time you are done you will end up with something resembling ngrx.
For a simple one service data, ngrx is overkill, lots of boilerplate, but for a reactive app with multiple data sources or plex data interactions across numerous developers having a well used library is really helpful.
Follow SO answer for more in depth explanation: What are benefits of using store (ngrx) in angular 2
To understand, when to use which approach, read this: RxJs and Ngrx Store - When to Use a Store And Why?
本文标签: javascriptWhy use NGRX instead of constructor injected servicesStack Overflow
版权声明:本文标题:javascript - Why use NGRX instead of constructor injected services? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741295992a2370821.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论