How to make a Material UI react Button act as a react-router-dom Link?

Okay, this is very easy, I don't know why it was not working with me:

Just do like this:

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

<Button component={Link} to="/about" variant="contained" color="primary">
  About Page
</Button>

You can find more details at https://next.material-ui.com/guides/routing/.


MUI 5 has simplified this even further. Simply provide a MUI Button with a href attribute as follows:

import Button from '@mui/material/Button';


<Button href="/" variant="contained">
  Link
</Button>

You need to wrap the <Button /> inside the <Link /> component.

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

const ButtonWithLink = () => (
  <Link to="/about">
   <Button variant="contained" color="primary">
     About Page
   </Button>
  </Link>
)