So I wanted to create a universal action creator to manage the items in redux store.
Let's say my redux store looks like this:
one: '',
two: '',
three: ''
My action creators looks like this:
export const setStatus = (name, status) =>{
return function(dispatch){
dispatch({
type: 'SET_STATUS',
name,
status
})
}
}
and I don't know how to create an action that would manage all of it. Tried
case 'SET_STATUS':{
return{
...state,
action.name: action.status
}
}
But redux won't let me. Is there any workaround?