It's important to think about how you design your components and routes. If we added an exact prop this strategy would not work. ![]() I want to be clear, this works because the original /profile route that we rendered did not have an exact prop. import React from "react" import ReactDOM from "react-dom" import "./index.css" import function of route the props from that would the the equal to /profile/edit. So that means our profile route will match anytime you hit /profile or anything beyond that like /profile/edit. One thing to point out is that there is no exact flag set on our /profile route. The Switch route will render the first route that is matched. The first is a home route, the second is a route to the Profile page. Let's explore how to create a modal, and how we can go about turning into a route while not un-rendering the current route. The only mechanism for storing state that is shareable across users is via the URL. ![]() However on a refresh that state will no longer exist so the modal will close. ![]() Regardless of the situation in React most modals are presented by toggling a piece of state. Are they a route? Are they just presenting info? Do users need to get back to whatever they're presenting? ![]() Modals present a tricky situation for many applications.
0 Comments
Leave a Reply. |