I am using redux-saga and redux-actions with Typescript, like this:
const moviesReducer = handleActions( { [actions.fetchMovies]: (state) => ({ ...state, details: {...initialState.details}, }), [actions.fetchMoviesSuccess]: (state, action) => { return { ...state, details: {...state.details, ...action.payload}, }; }, [actions.fetchMoviesFailed]: (state, {payload}) => ({ ...state, error: payload, }), }, initialState, );
I have tried many answers from here:Typescript setState with computed property names
but nothing fits my case.
I got the error to go doing this:
[actions.fetchMovies.toString()]: (state) => ({ ...state, details: {...initialState.details},}),
But I am afraid that may cause issues later onAny insight would be appreciated.
Thank you.