Package Exports
- react-dialogs-container
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-dialogs-container) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-dialog-container
Library for manage dialogs inside application
Setup:
- Place DialogsProvider over your application
- Place DialogsContainer inside your application
Example to use
const App = () => {
const { pushDialog } = useDialogsContainer();
return (
<button onClick={() => pushDialog(ModalComponent, { taste: "So tasty" })}>
Open Modal
</button>
);
};
const Root = () => (
<DialogsProvider>
<App />
<DialogsContainer />
</DialogsProvider>
);
API
Hooks
useDialogsContainer
pushDialog(component, props): number - push new dialog component, return dialog identificator
closeDialogByID(dialogID) - close dialog by identificator
useDialog - return methods base on inherited context
closeDialog - fucntion to close dialog