I am working on a react app where I am using redux for state management,I am new to this and I have to do multiple state change operations inside a reducer function.
Here's my reducer function:
case Actions.ON_SUBMIT_CLIENT: {
return {
...state,
clientList: [...state.clientList, action.client]
}
}
What I want to do is,add a item to clientList
which I am doing here and then re-assign 2 variables clientName
and clientStatus
too like:
case Actions.ON_SUBMIT_CLIENT: {
return {
...state,
clientList: [...state.clientList, action.client],
clientName: "",
clientStatus: "",
clientAccessGrants: []
}
}
How can I achieve this inside the reducer function? Any help will be highly appreciated.
Here's my github link: here
you can see the reducer in clientReducer,the ON_SUBMIT action call in Form/PopupActions.