-
-
Notifications
You must be signed in to change notification settings - Fork 759
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prefer granular routeConfigs, support type-safe library exports
- Loading branch information
1 parent
0bacb29
commit 5ee825f
Showing
55 changed files
with
990 additions
and
700 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,32 @@ | ||
import * as React from 'react' | ||
import { Outlet } from '@tanstack/react-router' | ||
import { Link, Outlet } from '@tanstack/react-router' | ||
import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' | ||
|
||
import { router } from './router' | ||
|
||
export function App() { | ||
return ( | ||
// Build our routes and render our router | ||
<> | ||
<div> | ||
<router.Link | ||
<Link | ||
to="/" | ||
activeProps={{ | ||
className: 'font-bold', | ||
}} | ||
activeOptions={{ exact: true }} | ||
> | ||
Home | ||
</router.Link>{' '} | ||
<router.Link | ||
</Link>{' '} | ||
<Link | ||
to="/posts" | ||
activeProps={{ | ||
className: 'font-bold', | ||
}} | ||
> | ||
Posts | ||
</router.Link> | ||
</Link> | ||
</div> | ||
<hr /> | ||
<Outlet /> | ||
<TanStackRouterDevtools router={router} /> | ||
<TanStackRouterDevtools /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import { createReactRouter } from '@tanstack/react-router' | ||
import { routeConfig } from './routeConfig' | ||
|
||
// Set up a ReactRouter instance | ||
export const createRouter = () => | ||
createReactRouter({ | ||
routeConfig, | ||
// defaultPreload: 'intent', | ||
}) | ||
|
||
export const router = createReactRouter({ | ||
routeConfig, | ||
// defaultPreload: 'intent', | ||
}) | ||
declare module '@tanstack/react-router' { | ||
interface ResolveRouter { | ||
router: ReturnType<typeof createRouter> | ||
} | ||
} |
Oops, something went wrong.