问题描述
是有问题的表格 https://github.com/lukeclarkson/portal/blob/master/components/client/AddClientForm.js 这是表单容器 https://github.com/lukeclarkson/portal/blob/master/containers/client/AddClientContainer.js .
It is the form that has problemhttps://github.com/lukeclarkson/portal/blob/master/components/client/AddClientForm.jsAnd it is the form containerhttps://github.com/lukeclarkson/portal/blob/master/containers/client/AddClientContainer.js.
我在有效"表格中添加了一个新字段它具有数据库字段状态"我为它创建了组件 https://github.com/lukeclarkson/portal/blob/master/components/common/form/renderRadioGroup.js
I added a new field to the form "Active"It has database field "status"I created component for ithttps://github.com/lukeclarkson/portal/blob/master/components/common/form/renderRadioGroup.js
我面临传递redux值的问题.
I am facing problem to pass redux value to it.
我的文本组件自动从redux中获取价值. https://github.com/lukeclarkson/portal/blob/master/components/common/form/renderText.js
My text component is automatically taking value from the redux.https://github.com/lukeclarkson/portal/blob/master/components/common/form/renderText.js
有人可以帮助我吗?
推荐答案
如果要从redux提取数据,可以将redux状态映射到props.阅读官方文档 https://react-redux.js.org/using-react-redux/connect-mapstate#connect-extracting-data-with-mapstatetoprops ,然后您就可以使用props访问组件中的redux数据并通过无线电分组为this.props.nameOfYourProp
if you want to extract data from redux you can map the redux state to props. read the official documentation https://react-redux.js.org/using-react-redux/connect-mapstate#connect-extracting-data-with-mapstatetoprops and then you can access redux data in you component with props and pass in your radio group as this.props.nameOfYourProp
这篇关于将Redux值传递给Material UI Radio组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!