Front-end routing for airx
import * as airx from 'airx'
import { RouteComponentProps, Router } from 'airx-router'
function TestRouteComponent(props: RouteComponentProps) {
// Matching child routes will be rendered here
return () => props.children
}
const route = {
path: '/root',
component: TestRouteComponent,
children: [
{
path: '/',
redirect: 'child-1'
},
{
path: 'child-1',
component: TestRouteComponent,
children: [
{
path: '/',
redirect: 'child-2'
},
{
path: 'child-2',
component: TestRouteComponent
}
]
}
]
}
airx
.createApp(<Router routes={[route]} />)
.mount(document.getElementById('app'))