router changes
This commit is contained in:
12
src/router/Route.tsx
Normal file
12
src/router/Route.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import {PropsWithChildren} from "react";
|
||||
import {useRouter} from "./RouterContext";
|
||||
import {Path} from "./router";
|
||||
|
||||
export function Route(props: PropsWithChildren & {path: Path}) {
|
||||
const {path, children} = props;
|
||||
const router = useRouter();
|
||||
|
||||
return <>
|
||||
{ router.current?.currentPage === path && children}
|
||||
</>
|
||||
}
|
||||
Reference in New Issue
Block a user