guys how to append an object to an empty array in redux toolkit? I have set a
currentTimeOfServices:[]
in my slice then I dispatch an action with a payload
dispatch(userActions.getCurrentTime({ startTime: startTime, name: item }));
In my getCurrenTtime reducer I don't understand how to append this item.
getCurrentTime: (state, action) => {
state.currentTimeOfServices = [
...state.currentTimeOfServices,
{ startTime: action.payload.startTime, name: action.payload.name },
];
}
This is wrong and I know that but I want to know how to add/append an object to this currentTimeOfServices empty array?