Skip to content

TongChia/dyo-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dyo-router

dyo router

USAGE

import { render } from 'dyo';
import createRouter from 'dyo-router';
import Login from './Login';
import Layout from './Layout';

const router = createRouter([
    {
        path: '/login', 
        component: Login,
    },
    {
        path: '/',
        component: Layout,
        childrens: [
            {
                path: '/home', 
                component: lazy(() => import('./HomePage').then(module => module.default)),
            },
            {
                path: '/post', 
                component: lazy(() => import('./PostPage').then(module => module.default)),
            },
            {
                path: '(.*)',
                redirect: '/home',
            }
        ]
    }
], /* {history} */)

render(router, document.body);

Releases

No releases published

Packages

No packages published