首页 > 解决方案 > Redux 和 3rd 方库

问题描述

我们正在构建一个管理面板,我们以 ngx-admin 为基础。

我想在项目中使用@ngxs/store。但是管理面板有 3rd 方库和组件,它们不能以 redux 方式工作。

我应该使用 @ngxs/store 吗?如何控制来自 3rd 方库的操作?或者 @ngxs/store 是否需要不使用 3rd 方组件的项目?

例如,它使用 ng2-smart-table。表格有排序、过滤等。所有这些动作都应该是一个 redux 动作,并且它们应该有适当的 reducer。但是该组件已准备好使用,并且对全局状态一无所知,也没有任何方法可以使用它...

所以,问题是,我应该使用 @ngxs/store,还是应该使用原生 Angular 并仅将 Redux 留给自己编写的应用程序,而不使用 3rd 方库?

标签: angularreduxngrxfluxngxs

解决方案


The answer is: it depends.

If you want to implement Redux and keep track of everything you will need to create actions yourself for 3rd party components. But keep in mind that for a table you might not need actions for everything, and store only the rows data you are going to display.


推荐阅读