Dmitry
Dmitry

Reputation: 21

Link not working in dashboard of react-admin

I'm trying to make a Link from dashboard to some of resource in my project. I used button with component={Link} option.

It changes my url, but page remains same

It occur error in JS console: does not support changing store on the fly. It is most likely that you see this error because you updated to Redux 2.x and React Redux 2.x which no longer hot reload reducers automatically. See https://github.com/reactjs/react-redux/releases/tag/v2.0.0 for the migration instructions.

and my admin interface not in root

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

Upvotes: 2

Views: 3440

Answers (1)

Kmaschta
Kmaschta

Reputation: 2429

React Admin is using react-router to manage its routing.

Also, the <Button> component from React Admin doesn't have the same API than the Material UI one.

If you want a link that looks like a Button, you should import the button from Material UI and use the react-router API to trigger a route change.

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

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

Upvotes: 3

Related Questions