简体   繁体   中英

How retrieve current redux-form state field value in react class form component?

I have a react form component class containing two redux-form Fields. The form component is wrapped by reduxForm and a container component defining mapStateToProps, mapDispatchToProps functions. Each field is passed an onChange function defined in the form component.

I tried creating a selector on the form using formValueSelector, but the selected values don't update as the field values change.

How can I get the current state.form value of the other field in a onChange function?

I'm using:
"react": "^15.5.4",
"redux-form": "^6.8.0",

Since redux-form questions tend to go unanswered at stackoverflow, I raised a redux-form issue: https://github.com/erikras/redux-form/issues/3110#issuecomment-312135987

This resulted in a couple of runnable examples of how to retrieve the current state.form value of a Field. Once you have that, you can pass it to an onChange function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM