Код: Выделить всё
react-router.config.tsКод: Выделить всё
import type { Config } from "@react-router/dev/config";
export default {
ssr: true,
} satisfies Config;
< /code>
routes.tsxКод: Выделить всё
import { type RouteConfig } from "@react-router/dev/routes";
import { flatRoutes } from "@react-router/fs-routes";
export default flatRoutes() satisfies RouteConfig;
< /code>
root.tsxКод: Выделить всё
import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
type MetaFunction,
type LinksFunction,
} from 'react-router';
import '../styles.css';
import EntryCommon from './entry.common';
export const meta: MetaFunction = () => [
{
title: 'New Nx React Router App',
},
];
export const links: LinksFunction = () => [
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{
rel: 'preconnect',
href: 'https://fonts.gstatic.com',
crossOrigin: 'anonymous',
},
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap',
},
];
export function Layout({ children }: { children: React.ReactNode }) {
return (
{children}
);
}
export default function App() {
return ;
}
< /code>
Now, the issue I face is, when, inside a route in my apps/routes/chunk-kned5 Компонент.
Но я не понимаю, зачем мне обернуться вокруг маршрутизатора, так как я использую соглашение о файле маршрутов.
Какова правильная настройка?>
Подробнее здесь: https://stackoverflow.com/questions/795 ... -fs-routes