actionCreators的代码如下:
const changeDetail = (title, content) => ({
type: constants.CHANGE_DETAIL,
title,
content
});
export const getDetail = (id) => {
return (dispatch) => {
axios.get(’/api/detail.json?id=’ + id).then((res) => {
const result = res.data.data;
dispatch(changeDetail(result.title, result.content));
}).catch(() => {
})
}
};
然后在reducer里就直接将没有经过immutable处理的数据赋值给state了:
export default (state = defaultState, action) => {
switch(action.type) {
case constants.CHANGE_DETAIL:
return state.merge({
title: action.title,
content: action.content
})
default:
return state;
}
}
请问这里的title和content不需要处理为immutable的数据么?