react-redux-promising-modals - Modals for React.js
This simple redux-react component allows you to create and handle modals easily using react and redux.
Check out redux-promising-modals to dig deeper into the topic.
Basic Usage
Register the reducer
;; /* your's reducers */ modals: modalsReducer;
Add middleware to the store
;;;; const store = ;
Create a Modal dialog (Any react component can serve as a dialog)
This example uses Semantic UI Modal component
const ConfirmModal = <Modal open=visible trigger=<Button>Basic Modal</Button> basic size='small'> <Header icon='archive' content='Archive Old Messages' /> <ModalContent> <p>Your inbox is getting full would you like us to enable automatic archiving of old messages?</p> </ModalContent> <ModalActions> <Button basic color='red' inverted onClick=> <Icon name='remove' /> No </Button> <Button color='green' inverted onClick=> <Icon name='checkmark' /> Yes </Button> </ModalActions> </Modal>
Register the Modal dialog on the page
Usually the best place is at the bottom of the app
; <App> <Modals> <ModalsModal name="confirm" component=ConfirmModal/> </Modals></App>
Call the modal dialog
All additional parameters passed to showModals are passed to the modal dialog (in this example title and message)
; const Page = <div> <Button onClick=/> </div> Page;
License
react-redux-promising-modals is available under MIT. See LICENSE for more details.