Here's the state data structure:
projectData:
{
projectCode: '',
projectName: '',
projectDescription: '',
clientCode: '',
clientName: '',
officeCode: '',
office: '',
industryTypeName: '',
statusName: '',
statusCode: '',
projectResources: []
}
Here's the reducer, when this gets executed all the state data is lost except projectResources
case "SET_PROJECTROLE":
{
const newResources = [...state.projectData.projectResources];
newResources[action.payload.Index].ProjectRole = action.payload.ProjectRole;
return {
...state,
projectData:
{
...state.projecData,
projectResources: [...newResources]
}
};
}
Top comments (1)
Gosh! you saved me!! :) thanks @3in0