Closed ArturKustyaev closed 4 months ago
To auto hide modal when parent component is destroyed, you need to use the declarative way: https://opensource.ebay.com/nice-modal-react/#declarative
To auto hide modal when parent component is destroyed, you need to use the declarative way: https://opensource.ebay.com/nice-modal-react/#declarative
Then what's the point of using the NiceModal.show() approach. For me it is preferable, since I receive data from the callback and, depending on the role, show different drawers:
const updateBranchClickHandler = useCallback((branch: Branch) => {
if (isUserManager) {
NiceModal.show(LimitsDrawer, { branch });
} else {
NiceModal.show(BranchDrawer, { branch });
}
}, []);
The branch property is mandatory and with a declarative approach I won’t be able to push them into the component itself, since I get this property from the callback.
Is it possible to add a RemoveAll method that removes all modal windows from their context, for example when changing the page?