mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-29 22:02:46 -07:00
341fba6ca9
* feat: preload chunk when links are visible in the viewport * feat: update version to v0.9.0
23 lines
575 B
TypeScript
23 lines
575 B
TypeScript
import * as React from 'react'
|
|
import { useRouterStore } from '../hooks/useRouterStore'
|
|
import { RouteMatch } from './RouteMatch'
|
|
import NotFound from './NotFound'
|
|
import useRoute from '../hooks/useRoute'
|
|
|
|
interface MatchesProps {
|
|
// user defined props
|
|
serverSideProps: any
|
|
}
|
|
|
|
export function Matches({ serverSideProps }: MatchesProps): JSX.Element {
|
|
const location = useRouterStore((st) => st.location)
|
|
|
|
const route = useRoute(location.pathname)
|
|
|
|
if (!route) {
|
|
return <NotFound />
|
|
}
|
|
|
|
return <RouteMatch route={route} serverSideProps={serverSideProps} />
|
|
}
|