Skip to content

Allow appElement prop to call setAppElement #899

@YPCrumble

Description

@YPCrumble

Summary:

Currently I don't think react-modal is compatible with code splitting using loadable-components because of needing to call Modal.setAppElement(). The issue is that if we load the Modal element like this:

const Modal = loadable(() => import('react-modal'))

...then Modal won't have resolved at runtime when we call Modal.setAppElement.

My suggestion is to call setAppElement from within the constructor if we pass an appElement prop to the Modal.

Thanks for maintaining this repo, and please let me know if a PR to do the above would be welcomed, as I'd love to contribute!

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