提示语的无关痛痒,让我找了好久。。。
import { Link } from 'react-router';
react-router已经移除Link组件,改成了 react-router-dom中去实现Link组件
import { Link } from 'react-router-dom';
以下是坑爹的报错信息:
还有代码:
<Menu theme="dark" defaultSelectedKeys={['0']} mode="inline">
{routes.map(route => {
return (
<Menu.Item key={route.key}>
<Icon type={route.icon} />
<Link to={route.path}>{route.text}</Link>
</Menu.Item>
);
})}
</Menu>
routes.js
import user from '../pages/users';
import team from '../pages/team';
export default [
{
key: '0',
path: '/user',
icon: 'user',
text: '用户管理',
component: user,
},
{
key: '1',
path: '/team',
icon: 'team',
text: '团队管理',
component: team,
},
];