From e57036fa654cc260e5a5ca046c40db8bb738b278 Mon Sep 17 00:00:00 2001 From: Alexandre Mouton-Brady Date: Fri, 30 Jul 2021 19:17:56 +0200 Subject: [PATCH] :wrench: Update router to latest API --- ts-router/src/app.tsx | 9 ++++++--- ts-router/src/index.tsx | 3 +-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ts-router/src/app.tsx b/ts-router/src/app.tsx index 4567a32..f76e7ea 100644 --- a/ts-router/src/app.tsx +++ b/ts-router/src/app.tsx @@ -1,8 +1,11 @@ import { Component } from "solid-js"; -import { Link, Route, useRouter } from "solid-app-router"; +import { Link, useRoutes, useLocation } from "solid-app-router"; + +import { routes } from "./routes"; const App: Component = () => { - const [router] = useRouter(); + const location = useLocation(); + const Route = useRoutes(routes); return ( <> @@ -30,7 +33,7 @@ const App: Component = () => { class="w-75px p-1 bg-white text-sm rounded-lg" type="text" readOnly - value={router.location} + value={location.pathname} /> diff --git a/ts-router/src/index.tsx b/ts-router/src/index.tsx index e1b308c..a864b1d 100644 --- a/ts-router/src/index.tsx +++ b/ts-router/src/index.tsx @@ -2,12 +2,11 @@ import "windi.css"; import { render } from "solid-js/web"; import { Router } from "solid-app-router"; -import { routes } from "./routes"; import App from "./app"; render( () => ( - + ),