我想知道是否可以在 ngrx selectors 中访问 previous 和 current 状态。我一直无法找到这方面的相关信息。是因为我使用了createSelector吗?有可用的“工厂方法”吗?我的目标是访问当前和之前的状态并执行一些操作来导出数据。 如果可以的话,请分享一些例子。 预先感谢!
pairwise
store.pipe(select(<selector>)
startWith({ oldValue: null, newValue: null }),
distinctUntilChanged(),
pairwise(),
map(([oldValue, newValue]) => { return { oldValue, newValue } })
)
.subscribe({
next: (val) => {
console.log(val)
}
});