将Redux值传递给Material UI Radio组 [英] Passing Redux value to Material UI Radio Group

查看:71
本文介绍了将Redux值传递给Material UI Radio组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是有问题的表格 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 problem https://github.com/lukeclarkson/portal/blob/master/components/client/AddClientForm.js And it is the form container https://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 it https://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组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆