Navigate Between Pages

In umi, there are two ways to navigate between pages: declarative and imperative.

Declarative

it is usually used as a React component.

import { Link } from 'umi';
export default () => (
<Link to="/list">Go to list page</Link>
);

Command

Based on umi/router, it is usually called in event processing.

import { history } from 'umi';
function goToListPage() {
history.push('/list');
}

You can also get the history directly from the component's properties

export default (props) => (
<Button onClick={()=>props.history.push('/list');}>Go to list page</Button>
);

For more command-style jump methods, see api#history.