Comments (2)
To auto hide modal when parent component is destroyed, you need to use the declarative way:
https://opensource.ebay.com/nice-modal-react/#declarative
from nice-modal-react.
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.
from nice-modal-react.
Related Issues (20)
- Type regression in 1.2.9 HOT 13
- remove() Function without Modal ID just like hide() HOT 2
- Refactor modalHandler into a React Hook HOT 2
- [Request] Add default to remove modal HOT 3
- [Request] Improve typing of modal props HOT 7
- Antd "visible" prop is deprecated, use "open" instead HOT 1
- [deep loop] Can't use in component? HOT 1
- hide Promise does not resolve if Modal is already hidden HOT 1
- Using nested NiceModalProvider for new window HOT 3
- Removing modal on page route change HOT 10
- resolveHide function not working HOT 1
- not working for multi-instance with wrap Context
- defaultVisible HOT 2
- Can the show method intelligently prompts those parameters?
- How to bind props update via use NiceModal.show(MyModal, { loading, onOk }) HOT 4
- disable hide on outside click HOT 3
- Unnecessary re-render when showing multiple modals.. HOT 1
- did you embed your app with NiceModal.Provider?
- Rendering model in a particular html element HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nice-modal-react.