@router-cli/react-router-dev
Version:
File based routing cli for react-router-dom.
2 lines (1 loc) • 1.85 kB
TypeScript
export declare const template = "// Generated Code, changes to this file will be overridden.\n/* eslint-disable */\n\nimport { createElement } from \"react\";\nimport {\n createComponents,\n createHooks,\n createFunctions,\n AllLinkProps,\n createRoute,\n ExtractRouteDataMap,\n TypedTo,\n TypedToOrPath,\n createRoutes,\n RouterProvider,\n /*{browserType}*/\n} from \"@router-cli/react-router\";\n/*imports*/\n\nconst appRoutes = {\n app: undefined,\n notFound: undefined,\n pending: undefined,\n error: undefined,\n}\n\nexport const pageImports = {};\nexport const layoutImports = {};\n\nexport const routes = createRoutes({appRoutes, pageImports, layoutImports});\nexport const router = /*{browserType}*/(routes);\nexport const RouterOutlet = () => createElement(RouterProvider, { router }, null);\n\nexport type Pages = ExtractRouteDataMap<typeof pageImports>;\nexport type Routes = keyof Pages;\nexport type Layouts = ExtractRouteDataMap<typeof layoutImports>;\n\nexport const { Link, NavLink, Navigate } = createComponents<Pages>();\nexport const { useNavigate, useSearch, useLoaderData, useParams, useMatch } = createHooks<Pages, Layouts>({ pageImports, layoutImports });\nexport const { matchPath, redirect } = createFunctions<Pages>();\nexport { Outlet, useLocation } from \"@router-cli/react-router\";\n\nexport type LinkProps<TPath extends Routes = Routes> = AllLinkProps<TPath, Pages>[\"link\"];\nexport type NavLinkProps<TPath extends Routes = Routes> = AllLinkProps<TPath, Pages>[\"navLink\"];\nexport type NavigateProps<TPath extends Routes = Routes> = AllLinkProps<TPath, Pages>[\"navigate\"];\nexport type To<TPath extends Routes = Routes> = TypedTo<TPath, Pages[TPath]>;\nexport type ToOrPath<TPath extends Routes = Routes> = TypedToOrPath<TPath, Pages[TPath]>;\n\nexport {\n createRoute,\n};\n\n/*exports*/\n";