Closed dragonfire1119 closed 2 years ago
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]);
I know this is out of scope but does anybody have ideas on opening nice modals based on the URL?
Example: /posts/create it opens the create post modal but if the user refreshes the page it opens the modal based on the URL.
This lib is awesome!