import * as React from 'react'; import PropTypes from 'prop-types'; import { Link as RouterLink, MemoryRouter, StaticRouter } from 'react-router'; import { ThemeProvider, createTheme } from '@mui/material/styles'; import Button from '@mui/material/Button'; import Stack from '@mui/material/Stack'; import Link from '@mui/material/Link'; const LinkBehavior = React.forwardRef((props, ref) => { const { href, ...other } = props; // Map href (MUI) -> to (react-router) return ; }); LinkBehavior.propTypes = { href: PropTypes.oneOfType([ PropTypes.shape({ hash: PropTypes.string, pathname: PropTypes.string, search: PropTypes.string, }), PropTypes.string, ]).isRequired, }; function Router(props) { const { children } = props; if (typeof window === 'undefined') { return {children}; } return {children}; } Router.propTypes = { children: PropTypes.node, }; const theme = createTheme({ components: { MuiLink: { defaultProps: { component: LinkBehavior, }, }, MuiButtonBase: { defaultProps: { LinkComponent: LinkBehavior, }, }, }, }); export default function LinkRouterWithTheme() { return ( Link ); }