You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Zenon Router is designed to be simple and fast, making it ideal for small-scale SPAs. It provides full control over routing with minimal overhead. It’s perfect for developers who want a router that just works and works efficiently..
✅ Features
⚡ Blazing fast & minimal – Zero dependencies
✅ Type-safe – Written in TypeScript with support for JavaScript
🧭 History API-based routing – pushState & popstate powered navigation
🔄 Dynamic route registration – Add routes at runtime
🔧 Programmatic navigation – push, replace, and resolveRoute methods
import{createRouter,Route}from"zenon-router";constrouter=createRouter({history: "history",
routes,});router.resolveRoute();// Call once on page load to resolve current route
3. Navigate programmatically
router.push("/about");// Changes URL and loads the About pagerouter.replace("/home");// Replaces the current history state with the Home page
4. Access a route by path or name
consthomeRoute=router.getRouteByPath("/");// Get route by pathconstaboutRoute=router.getRouteByName("about");// Get route by name
📘 API Reference
createRouter(options: RouterOptions): ZenonRouter
Creates and returns an instance of the router.
interfaceRouterOptions{history?: "hash"|"history";// Default is "history"routes: Route[];}