我正在我的Redux reducer中创建一个空的编辑器状态:
import { EditorState } from 'draft-js'
const defaultState = {
editorState: EditorState.createEmpty()
}
const editor = (state = defaultState, action) => {
switch (action.type) {
case 'UPDATE_EDITOR_STATE':
return Object.assign({}, state, {
editorState: action.payload.editorState
})
default:
return state
}
}
但是在props中注入的editorState是一个普通的Object:
EditorState { _immutable: {} }
所以我遇到的错误就像getCurrentInlineStyle不是函数
当我从构造函数创建editorState时,一切都很好,我有一个Record Object:
EditorState { _immutable: Record }
我的Redux减速机出了什么问题?
感谢。