feat: set zustand store server side

This commit is contained in:
Valerio Ageno
2024-05-15 20:42:16 +02:00
parent da75dc4a07
commit fc1d9013f8
4 changed files with 23 additions and 15 deletions
@@ -1,18 +1,13 @@
import * as React from 'react'
import { useRouter } from '../hooks/useRouter'
import { useRouterStore } from '../hooks/useRouterStore'
import { RouteMatch } from './RouteMatch'
import NotFound from './NotFound'
interface MatchesProps {
serverPath?: string
}
export function Matches({ serverPath }: MatchesProps): JSX.Element {
export function Matches(): JSX.Element {
const location = useRouterStore((st) => st.location)
const router = useRouter()
const route = router.routesById[location?.pathname || serverPath || '']
const route = router.routesById[location.pathname]
if (!route) {
return <NotFound />