Comments (1)
Yes, you can persist modal state in the URL, sample code like below:
const loc = useLocation();
const modal = useModal(PostModal);
useEffect(() => {
if (loc.pathname.startsWith('/posts/create') modal.show();
else modal.hide();
}, [loc, modal]);
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 5
- 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
- Add removeAll() method HOT 2
- 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.