Answer the question
In order to leave comments, you need to log in
How to remove/apply filter using immutable.js?
This is the initial_state
const INITIAL_STATE = Immutable.fromJS({
cards: List([])
});
const addCard = (state, action) => {
console.log("addCardReducer", state.get('cards'))
return state.update('cards', card => card.push(Map({
id: Math.random().toString(36).substring(7) ,
name: '',
})))
}
const deleteCard = (state, action) => {
console.log("deleteCardReducer", state.get('cards'))
return { cards: state.get('cards').filter (card => {
return card.get('id') !== action.id
}) }
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question