链接在react-admin仪表板中不起作用

时间:2019-08-04 10:29:34

标签: hyperlink react-admin

我正在尝试从仪表板建立到项目中某些资源的链接。我使用带有component = {Link}选项的按钮。

它更改了我的网址,但页面保持不变

在JS控制台中发生错误:  不支持即时更改store。您最有可能看到此错误,因为您已更新到Redux 2.x和React Redux 2.x,它们不再自动热重装减速器。有关迁移说明,请参见https://github.com/reactjs/react-redux/releases/tag/v2.0.0

我的管理界面不在root用户中

<Button component={Link} to={{pathname: "/new_admin/#/issuing_history"}}type="button" color="success" size={"sm"}> </Button>

1 个答案:

答案 0 :(得分:0)

React Admin使用react-router来管理其路由。

此外,React Admin的<Button>组件所使用的API与Material UI所使用的API不同。

如果您希望链接看起来像一个按钮,则应从Material UI导入按钮,并使用react-router API触发路线更改。

import Button from '@material-ui/core/Button';
import { Link } from 'react-router-dom';

const MyButton = () => (
    <Button
        component={Link}
        to={{ pathname: "/issuing_history" }}
    />
);

相关问题