Skip to content

Question: Unmount component #434

Closed
Closed
@enheit

Description

@enheit

I have a problem with states inside react-modal. I have couple of components inside react-modal. After I close this modal and reopen again, states of internal components still the same (for instance, input values do not reset after modal toggling). Is there such a possibility to reset all state inside react-modal after close? I know it should be done inside componentWillUnmount but as far as I understood react-modal hides instead of unmounting.

My current solution is - do not render modal until open.

state = {
 isModalOpen: false
}

// somewhere in component
{ isModalOpen && <Modal isOpen={ isModalOpen }  /> }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions