Some components (like Buttons) might end up rendering a tags. That's ok, but in usually you cannot use "links" in SPA - they have to be Links, playing nicely with the router of your choice.
It's expected that SPA is using some router, and only one router, as well as expected to use one, and only one Link.
That "right link" should be configurable via Theme.
Summary 💡
Long story short - for example button should read value from the theme, not use hardcoded one.
https://github.com/mui-org/material-ui/blob/49eb56aefa997dcbf6fbc0515b7d1fafc19a55dd/packages/material-ui/src/ButtonBase/ButtonBase.js#L264-L266
Examples 🌈
Motivation 🔦
Every component which might render a link could do it - all you have to provide a right Component instead of default. That's not always handy and working for everyone.
Recently I've seen:
- Buttons wrapped with Links to make them Links
- Buttons with
onClick={()=>history.push()} to make them play nicely together with router.
All that might be fixed with a single configuration option.
It still would be not possible to use, for example, react-router/Link as a link, due to interface differences, however the wrapper to make Link an a-compatible is just a few lines, and could be provided in MUI documentation as well.
Some components (like Buttons) might end up rendering
atags. That's ok, but in usually you cannot use "links" in SPA - they have to beLinks, playing nicely with therouterof your choice.It's expected that SPA is using some router, and only one router, as well as expected to use one, and only one Link.
That "right link" should be configurable via Theme.
Summary 💡
Long story short - for example button should read value from the theme, not use hardcoded one.
https://github.com/mui-org/material-ui/blob/49eb56aefa997dcbf6fbc0515b7d1fafc19a55dd/packages/material-ui/src/ButtonBase/ButtonBase.js#L264-L266
Examples 🌈
Motivation 🔦
Every component which might render a
linkcould do it - all you have to provide a right Component instead of default. That's not always handy and working for everyone.Recently I've seen:
onClick={()=>history.push()}to make them play nicely together with router.All that might be fixed with a single configuration option.
It still would be not possible to use, for example,
react-router/Linkas a link, due to interface differences, however the wrapper to makeLinkana-compatibleis just a few lines, and could be provided in MUI documentation as well.