react-redux-modal icon indicating copy to clipboard operation
react-redux-modal copied to clipboard

how to re-render a modal?

Open clindsey opened this issue 9 years ago • 2 comments

I'm trying to figure out how to update the modal after it's been displayed, like to update a price estimate value. Right now I'm able to modal.add(myComponent, {}) to create a modal and render myComponent but I can't figure out how to update the component. I could remove the modal and display it again with the new props but that would discard the user updates inside the modal, such as form fields.

I'm currently getting around this issue by using connect() on myComponet to link it directly to the store, but I'd prefer to use a basic component and not a redux container. What's the best way to do this? Maybe I should always specify a generic container for the modal and one of the options will be the actual component I want displayed? I feel like the problem will be that the container will need to know about every property any modal will need and will pass those to every modal it displays.

clindsey avatar Nov 07 '16 23:11 clindsey

No, I have no idea on how you can fix that other than use the connect.

diegoddox avatar Nov 08 '16 20:11 diegoddox

You can implement an UPDATE_MODAL action that takes as parameters a new component (created with your updated properties for that component class) and the id of the modal that it should replace.

idrm avatar May 12 '17 22:05 idrm