1.0.11 • Published 4 years ago

@enduranceidehen/modal-manager v1.0.11

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

React Modal Manager

A simple programmatic interface for rendering your modal components.

Why?

It would be nice if we could render a modal on demand, rather than embedding the component inside our views directly.

How do I use it?

First, Declare the ModalContainer at the root of your application

const App = () => {
  <div>
    <Router>
      stuff
    </Router>
    <ModalContainer />
  </div>
}

Next, whenever you want to programmatically render a modal, use the renderModal function, and pass your component.

    renderModal(props => {
      return (
        <Dialog {...props}>
          <DialogContent>Rendered Modal</DialogContent>
        </Dialog>
      );
    });

Simple as that.

License

MIT

Author

Endurance Idehen

1.0.11

4 years ago