【问题标题】: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)

【讨论】:

    猜你喜欢
    • 2016-11-23
    • 1970-01-01
    • 1970-01-01
    • 2013-06-09
    • 1970-01-01
    • 1970-01-01
    • 2011-07-24
    • 2019-09-14
    • 1970-01-01
    相关资源
    最近更新 更多