@boylu/router
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@boylu/router

This is the main package of @boylu/router. Browser playground on StackBlitz

Vercel npm

Installation

  • Add @boylu/router to your existing project:
  npm i @boylu/router
  yarn add @boylu/router
  pnpm i @boylu/router

Usage

Creating a project with Vite

  npm create vite@latest router-test -- --template vanilla
  yarn create vite router-test --template vanilla
  pnpm create vite router-test --template vanilla

Creating a Routes

// routes.js
export const routes = [
    {
        name: "home",
        path: "/",
        component: () => "<h1>Home Page</h1>",
    },
    {
        name: "about",
        path: "/about",
        component: () => "<h1>About Page</h1>",
    },
];

Creating a Router

// main.js
import { createRouter } from "@boylu/router";
import { routes } from "./routes.js";

document.querySelector("#app").innerHTML = `
  <nav>
    <a href="/" class="router-link">Home</a>
    <a href="/about" class="router-link">About</a>
  </nav>
  <div id="router-view"></div>
`;

createRouter(routes);

Package Sidebar

Install

npm i @boylu/router

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

14.3 kB

Total Files

15

Last publish

Collaborators

  • kadirboylu