alepha@docs:~/docs/packages/alepha/react$
cat router.md | pretty2 min read
Last commit:
#Alepha - React Router
#Installation
Part of the alepha package. Import from alepha/react/router.
npm install alepha
#Overview
Provides declarative routing with the $page primitive for building type-safe React routes.
This module enables:
- URL pattern matching with parameters (e.g.,
/users/:id) - Nested routing with parent-child relationships
- Type-safe URL parameter and query string validation
- Server-side data fetching with the
loaderfunction - Lazy loading and code splitting
- Page animations and error handling
#API Reference
#Primitives
$page— Main primitive for defining a React route in the application.
#React Hooks
useActive— Hook to determine if a given route is active and to provide anchor props for navigation.useQueryParams— Hook to manage query parameters in the URL using a defined schema.useRouter— Use this hook to access the React Router instance.
#Providers
ReactBrowserRendererProvider— Browser specific React renderer (react-dom/client interface)ReactBrowserRouterProvider— Implementation of AlephaRouter for React in browser environment.ReactPageProvider— Handle page routes for React applications. (Browser and Server)ReactPreloadProvider— Adds HTTP Link headers for preloading entry assets.ReactServerProvider— React server provider responsible for SSR and static file serving.ReactServerTemplateProvider— Handles HTML streaming for SSR.RootComponentsProvider— Extension point letting any module contribute root-level React nodes thatRouterLocaleProvider— Generic locale path-prefix mechanism for the router.SSRManifestProvider— Provider for SSR manifest data used for module preloading.