You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am having type problems when doing something like this:
constemit=(args)=>newPromise(...);/* some function -- Returns Promise<DataFormat> */constsetAll=createAsyncAction('setAll',(state: DataFormat)=>emit('setAll',state));constsync=createAsyncAction('sync',()=>emit('sync'));constallActions=[setAll,sync,];constreducers=allActions.map(action=>asyncReducer<string,DataFormat,unknown>(action));// @ts-ignore -- complains of reducer returning something incompatible no matter what I tried.constreducer: typeofreducers[0]=(state,action)=>{// Preferably I could do reducers.reduce((s, r) => r(s, action), state))letnewState={ ...state};reducers.forEach(reducer=>{newState=reducer(newState,action);});returnnewState;}exportdefaultreducer;
could maybe somebody help me out here? I would like to use 6-7 async action on the same store object (set, get, update, delete, etc...)
The text was updated successfully, but these errors were encountered:
brumik
changed the title
Q: Is it possible to combine an array of reducers on the same store?
Q: Is it possible to combine an array of asyncReducer?
Dec 19, 2021
Hello, I am having type problems when doing something like this:
could maybe somebody help me out here? I would like to use 6-7 async action on the same store object (set, get, update, delete, etc...)
The text was updated successfully, but these errors were encountered: