React components and hooks for building Alepha applications.
npm install @alepha/react
Provides full-stack React development with declarative routing, server-side rendering, and client-side hydration.
The React module enables building modern React applications using the $page primitive on class properties.
It delivers seamless server-side rendering, automatic code splitting, and client-side navigation with full
type safety and schema validation for route parameters and data.
Hooks provide a way to tap into various lifecycle events and extend functionality. They follow the convention of starting with use and return configured hook instances.
Main Alepha hook.
It provides access to the Alepha instance within a React component.
With Alepha, you can access the core functionalities of the framework:
Hook to get a virtual client for the specified scope.
It's the React-hook version of $client(), from AlephaServerLinks module.
Allow subscribing to multiple Alepha events. See {@link Hooks} for available events.
useEvents is fully typed to ensure correct event callback signatures.
1useEvents( 2 { 3 "react:transition:begin": (ev) => { 4 console.log("Transition began to:", ev.to); 5 }, 6 "react:transition:error": { 7 priority: "first", 8 callback: (ev) => { 9 console.error("Transition error:", ev.error);10 },11 },12 },13 [],14);
Hook to inject a service instance.
It's a wrapper of useAlepha().inject(service) with a memoization.