I\'m stating to learn react and redux today, yet I cannot figure out how to force component to rerender after state change.
Here is my code:
const s
I ended up here because I had written a bad reducer. I had:
const reducer = (state=initialState, action) => {
switch (action.type) {
case 'SET_Q':
return Object.assign(state, { // <- NB no {}!
q: action.data,
})
default:
return state;
}
}
I needed:
const reducer = (state=initialState, action) => {
switch (action.type) {
case 'SET_Q':
return Object.assign({}, state, { // <- NB the {}!
q: action.data,
})
default:
return state;
}
}