Routing
Recipies for routing in HellaJS applications.
Simple Routing
Section titled “Simple Routing”import { router } from '@hellajs/router';import { signal } from '@hellajs/core';
import Home from './pages/home';import About from './pages/about';
const activeRoute = signal(<>Loading...</>)
const appRouter = router({ '/': () => activeRoute(<Home />), '/about': () => activeRoute(<About />),});
const App() { return ( <div>{activeRoute}</div> );}
Lazy Loading
Section titled “Lazy Loading”import { router } from '@hellajs/router';import { signal } from '@hellajs/core';
const activeRoute = signal(<>Loading...</>)
const appRouter = router({ '/': () => import('./pages/home').then(module => activeRoute(m.default())), '/about': () =>import('./pages/about').then(module => activeRoute(m.default())),});
const App() { return ( <div>{activeRoute}</div> );}