Answer the question
In order to leave comments, you need to log in
How to delete?
How to delete board, list, todo.
const initialState = {
boards: {
byId: {
[ 45455 ]: {
id: 45455,
title: 'Дела',
listsIds: [ 34444 ]
}
},
allIds: [ 45455 ]
},
lists: {
byId: {
[ 34444 ]: {
id: 34444,
title: 'Тесты',
todosIds: [ 5555 ]
}
},
allIds: [ 34444 ]
},
todos: {
byId: {
[ 5555 ]: {
id: 5555,
title: 'Открыть',
active: true
}
},
allIds: [ 5555 ]
}
};
Answer the question
In order to leave comments, you need to log in
case DELETE_SOME_BY_ID:
const byId = { ...state.some.byId };
delete byId[action.payload.id];
const allIdis = state.some.allIdis.filter(el => el.id != action.payload.id);
return {
...state,
some: {
byId,
allIds,
},
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question