So I have this reducer that I would like to update
import { fromJS } from 'immutable';
const initialState = fromJS({
searchParams: {
limit: 100,
page: 1,
order_by: 'name',
filters: {
and_keywords : []
}
},
})
when the action is triggered I would like to push an object into the array of and_keywords. What I have done so far is this
case ADD_KEYWORDS:
return state
.setIn(['searchParams', 'filters', 'and_keywords'], '123');
I also tried
case ADD_KEYWORDS:
return state
.updateIn(['searchParams', 'filters', 'and_keywords'], arr => arr.push('123'))
basing from the documents in https://facebook.github.io, but I can't seem to make it work. No changes have been made after executing this command
state =to the start of your lines and it should work.function homePageReducer(state = initialState, action) {just did not include it as I only posted a snippet of my code