React/Redux forms


Topic: React/Redux forms

hberndt asked 6 years ago

I tried to use MDBInput in a form with redux. Is there a good example to do so? I like the way Availity do this. Is there a similar way?

Thanks for any help.

Regards, Holger


Anna Morawska staff answered 6 years ago

Hi, unfortunately, we don't have an example for that in our documentation but thank you for your suggestion. In general, MDBInput works as every other input - the best option is to save user input in the component state and then on onSubmit event attached to the form, dispatch an action, which will update a redux store.

Best, Ania


hberndt commented 6 years ago

Thank you for your reply. But there is an issue. My data is loaded via REDUX and mapped to the props in my component. I am searching for an example how to transfer the data to the state at the right time, so that MDBInput::value can be linked to components state. I want to avoid to develop an extra wrapper component for MDB to get a state for each.


Anna Morawska staff answered 6 years ago

Ok, I see. Maybe try to pass to the getValue prop a reference to the redux dispatch method. Then on every keystroke, an action will be dispatched and it will update the redux state.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.8.4
  • Device: PC
  • Browser: Chrome
  • OS: MacOS
  • Provided sample code: No
  • Provided link: Yes
Tags