0.12.0 • Published 9 months ago
native-router-react v0.12.0
Native Router React
A route close to the native experience for react.
English | 简体中文
Features
- Asynchronous navigation
- Cancelable
- Page data concurrent fetch
- Link prefetch and preview
- Most unused features can be tree-shaking
- SSR support
Install
npm i native-router-react
Usage
import {View, HistoryRouter as Router} from 'native-router-react';
import Loading from '@/components/Loading';
import RouterError from '@/components/RouterError';
import * as userService from '@/services/user';
export default function App() {
return (
<Router
routes={{
component: () => import('./Layout'),
children: [
{
path: '/',
component: () => import('./Home')
},
{
path: '/users',
component: () => import('./UserList'),
data: userService.fetchList
},
{
path: '/users/:id',
component: () => import('./UserProfile'),
data: ({id}) => userService.fetchById(+id)
},
{
path: '/help',
component: () => import('./Help')
},
{
path: '/about',
component: () => import('./About')
}
]
}}
baseUrl="/demos"
errorHandler={(e) => <RouterError error={e} />}
>
<View />
<Loading />
</Router>
);
}
See demos for a complete example.
Documentation
0.8.5
10 months ago
0.8.4
10 months ago
0.10.0
9 months ago
0.11.0
9 months ago
0.10.1
9 months ago
0.9.0
9 months ago
0.12.0
9 months ago
0.8.3
11 months ago
0.9.1
9 months ago
0.8.1
1 year ago
0.8.0
1 year ago
0.8.2
1 year ago
0.7.0
1 year ago
0.6.1
2 years ago
0.5.0
2 years ago
0.4.0
2 years ago
0.3.0
3 years ago
0.2.1
3 years ago
0.2.0
3 years ago
0.1.1
3 years ago
0.1.0
3 years ago