【问题标题】:redux-form fire action change value but not change input valueredux-form 火灾动作改变值但不改变输入值
【发布时间】:2018-04-16 07:27:02
【问题描述】:
我正在使用 redux-form 的简单表单。我可以看到更改字段的触发操作的日志,但是更改未显示在输入字段本身中。似乎 redux-form 无法更改输入值。我正在使用 React 16.3 版。
[更新]
我正在使用exact sampleredux-form 文档。
【问题讨论】:
标签:
reactjs
redux
redux-form
【解决方案1】:
我怀疑您没有将 redux-form 与 store 连接起来。我有一个同样的问题。这段代码很重要。
import { createStore, combineReducers } from 'redux'
import { reducer as formReducer } from 'redux-form'
const rootReducer = combineReducers({
// ...your other reducers here
// you have to pass formReducer under 'form' key,
// for custom keys look up the docs for 'getFormState'
form: formReducer
})
const store = createStore(rootReducer)