27 lines
865 B
TypeScript
27 lines
865 B
TypeScript
import {Route, useRoute} from ">able/iso-router.tsx";
|
|
|
|
const Tracer =()=>
|
|
{
|
|
const {nestedDepth, pathIndex, blocked} = useRoute();
|
|
return <div>Depth: {nestedDepth}, Index:{pathIndex}, Match:{blocked.value}</div>
|
|
}
|
|
|
|
export default ()=><div>
|
|
<h1 class="p-4 bg-red-500 text-white">App</h1>
|
|
<nav class="flex gap-10 p-6">
|
|
<a href="/">Home</a>
|
|
<a href="/about">About</a>
|
|
<a href="/404">404</a>
|
|
</nav>
|
|
<Route path={[]}><p>home page!</p></Route>
|
|
<Route path={["about"]}>
|
|
<nav class="flex gap-10 p-6">
|
|
<a href="/about/more">more</a>
|
|
<a href="/about/404">more 404</a>
|
|
</nav>
|
|
<Route path={[]}><p>About page!</p></Route>
|
|
<Route path={["more"]}><p>more!</p></Route>
|
|
<Route><span>couldnt find it</span></Route>
|
|
</Route>
|
|
<Route><p>404 :(</p></Route>
|
|
</div>; |