我有一个ngrx v8
样式化简器(使用 createReducer + on),它需要对路由更改做出反应。
let myAcction = createAction('my action', prop<boolean>);
let reducer = createReducer(
initialState,
on(myAction, (state, prop) => ({...state, example=prop })),
on(ROUTER_NAVIGATION, (state, routeParams) => ({...state, example2:{...routeParams}}))
)
这无法编译,因为ROUTER_NAVIGATION
不是动作创建者:
'"@ngrx/router-store/navigation"' 类型的参数不可分配给 'ActionCreator>' 类型的参数。类型“@ngrx/router-store/navigation”不可分配给类型“FunctionWithParametersType”
它不适用于RouterNavigationAction
以下任何一种:
'boolean' 类型的参数不能分配给 'ActionCreator>' 类型的参数
如何在 createReducer/on 函数中使用 ngrx/router-store 操作?我找不到为给定动作导出的动作创建者。