Passing Redux value to Material UI Radio Group

落爺英雄遲暮 提交于 2019-12-13 03:25:11

问题


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.

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

I am facing problem to pass redux value to it.

My text component is automatically taking value from the redux. https://github.com/lukeclarkson/portal/blob/master/components/common/form/renderText.js

Can anyone please help me?


回答1:


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



来源:https://stackoverflow.com/questions/59005564/passing-redux-value-to-material-ui-radio-group

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!