Recommended way to use Modals with routing? #889
-
From what I can tell, a useEffect(() => {
if (!visible) {
setTimeout(() => setVisible(true), 0);
}
}, []); as well as the following as the () => {
setFormVisible(false);
setTimeout(() => navigate("/"), 300); // Default modal transition duration
} This works and animates correctly, but still feels very hacky. Is there a recommended way of going about this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I do not see anything wrong with |
Beta Was this translation helpful? Give feedback.
I do not see anything wrong with
location.pathname.endswith("modal")
, I would do it similar way