# UI Router
NocoBase Client 的 Router 基于 [React Router](https://v5.reactrouter.com/web/guides/quick-start),可以通过 `` 来配置 ui routes,例子如下:
```tsx
/**
* defaultShowCode: true
*/
import React from 'react';
import { Link, MemoryRouter as Router } from 'react-router-dom';
import { RouteRedirectProps, RouteSwitchProvider, RouteSwitch } from '@nocobase/client';
const Home = () =>
Home
;
const About = () => About
;
const routes: RouteRedirectProps[] = [
{
type: 'route',
path: '/',
exact: true,
component: 'Home',
},
{
type: 'route',
path: '/about',
component: 'About',
},
];
export default () => {
return (
Home, About
);
};
```
在完整的 NocoBase 应用里,可以类似以下的的方式扩展 Route:
```tsx | pure
import { RouteSwitchContext } from '@nocobase/client';
import React, { useContext } from 'react';
const HelloWorld = () => {
return Hello ui router
;
};
export default React.memo((props) => {
const ctx = useContext(RouteSwitchContext);
ctx.routes.push({
type: 'route',
path: '/hello-world',
component: HelloWorld,
});
return {props.children};
});
```
完整示例查看 [packages/samples/custom-page](https://github.com/nocobase/nocobase/tree/develop/packages/samples/custom-page)