File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed
Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,14 @@ import {Step, Counter} from './Step';
6464 <Provider
6565 background = " base"
6666 router = { {
67- navigate : (href , opts ) => router .navigate ({... href , ... opts }),
68- useHref : href => router .buildLocation (href ).href
67+ navigate : (href , opts ) => {
68+ if (typeof href === " string" ) return ;
69+ return router .navigate ({ ... href , ... opts });
70+ },
71+ useHref : (href ) => {
72+ if (typeof href === " string" ) return href ;
73+ return router .buildLocation (href ).href ;
74+ }
6975 }} >
7076 { /* - end highlight -*/ }
7177 { /* Your app here... */ }
Original file line number Diff line number Diff line change 11import {Counter } from ' ./Step' ;
22
33<Counter />Render a ` RouterProvider ` at the root of your app to enable React Aria links to use your client side router. This accepts two props:
4-
4+
551 . ` navigate ` – a function received from your router for performing a client side navigation programmatically.
662 . ` useHref ` (optional) – converts a router-specific href to a native HTML href, e.g. prepending a base path.
77
@@ -58,9 +58,15 @@ export const Route = createRootRoute({
5858 let router = useRouter ();
5959 return (
6060 /* - begin highlight -*/
61- <RouterProvider
62- navigate = { (href , opts ) => router .navigate ({... href , ... opts })}
63- useHref = { href => router .buildLocation (href ).href } >
61+ <RouterProvider
62+ navigate = { (href , opts ) => {
63+ if (typeof href === " string" ) return ;
64+ return router .navigate ({ ... href , ... opts });
65+ }}
66+ useHref = { (href ) => {
67+ if (typeof href === " string" ) return href ;
68+ return router .buildLocation (href ).href ;
69+ }} >
6470 { /* - end highlight -*/ }
6571 { /* Your app here... */ }
6672 </RouterProvider >
You can’t perform that action at this time.
0 commit comments