I'm working on implementing beautiful-dnd in my react project.
I have the following data:
const initialData = {
users: {
'user-1': { id: 'user-1', name: 'John'},
'user-2': { id: 'user-2', name: 'Patrick'},
'user-3': { id: 'user-3', name: 'Malorie'},
'user-4': { id: 'user-4', name: 'Eric'},
'user-5': { id: 'user-5', name: 'Bob'},
'user-6': { id: 'user-6', name: 'Blob'}
},
areas: {
'area-0': {
id: 'area-0',
title: 'Main Area',
userIds: ['user-1', 'user-2', 'user-3', 'user-4', 'user-5', 'user-6']
},
'area-1': {
id: 'area-1',
title: 'Area 1',
userIds: []
},
'area-2': {
id: 'area-2',
title: 'Area 2',
userIds: []
}
},
areaOrder: ['area-0', 'area-1', 'area-2'],
}
In the reducer, I try to remove one of the users this way:
case REMOVE_USER_ACTION:
return {
...state,
users: [ ...state.users.filter(user => user !== action.id) ]
}
I'm getting this error:
TypeError: e.users.filter is not a function or its return value is not iterable
I searched for this error, but I'm unable to find a comparable scenario and how to fix this issue.