I'm using ReachUI Dialog to render a Dialog (Modal).
The Dialog is routable at the route products/create/, as you can see in the code below.
Is it possible to render both the ProductsTable (which is located at the parent route products/) and the Dialog, when I route to products/create so that I can see the ProductsTable component in the background of the modal?
I'm hoping to achieve this with react-router.
This is what the code looks like now:
...
import { Switch, Route, useRouteMatch, match, useHistory, } from "react-router-dom";
import { Dialog } from "@reach/dialog";
export function ProductsPage() {
const { url }: match = useRouteMatch();
const { push } = useHistory();
const gotToCreateProduct = () => push(`${url}/create`);
return (
<Switch>
<Route exact path={url}>
<Page title="Products" onCreateButtonClick={gotToCreateProduct}>
<ProductsTable></ProductsTable>
</Page>
</Route>
<Route path={`${url}/create`}>
<Dialog isOpen={true} onDismiss={() => push(url)}>
<ProductForm></ProductForm>
</Dialog>
</Route>
</Switch>
);
}