Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {BrowserHistory, Link, Route} from '../../bld/library';
const history = new BrowserHistory();
const router = new Router(history);
const route = router.$route({
default: {
$match: '',
},
account: {
$exact: true,
$children: {
id: {
$match: RouteMatch.segment,
},
},
},
});
@observer
export class App extends Component {
render(): ReactNode {
return (
<>
<h1>Boring Router</h1>
<p>Home page</p>
<div>
Account 123</div>
get avatarURL(): string {
return `https://gravatar.com/avatar/${this.id}`;
}
}
const router = new Router(history);
const route = router.$route({
default: {
$match: '',
},
account: {
$children: {
id: {
$match: RouteMatch.segment,
$extension: {
tick: undefined! as number,
account: undefined! as Account,
},
},
},
},
profile: true,
notFound: {
$match: RouteMatch.rest,
},
});
type AccountIdRouteMatch = typeof route.account.id;
class AccountIdRouteService implements IRouteService {