I have a reduxreducer which looks like this:
const initialState = {
visitedData:{specialty:false,review:false,reviewUpgrade:false}
}
const myred= (state = initialState, action) => {
switch (action.type) {
case 'GO_FOR_IT_SON':
return Object.assign({}, state, { visitedData: action.data });
default:
return state
}
}
Now from my reactcomponent I will call something like:
store.dispatch({type: 'GO_FOR_IT_SON', data:{review:true} });
or:
store.dispatch({type: 'GO_FOR_IT_SON', data:{specialty:false} });
So each of these statements are supposed to set one of the properties of visitedData to true/false and leaving the other ones intact. How can I set each of the properties of visitedData to true/false and leaving the other properties unchanged?