Persistent Drawer links not working as expected with react-router-dom
See original GitHub issueWhen mdc-web persistent drawer is used with react-router-dom (BrowserRouter), the links inside the drawer are losing SPA behavior. That is links the links (html <a>
) inside the drawer are bypassing react-router, and making a fresh request to the server.
What MDC-Web Version are you using?
https://unpkg.com/material-components-web@latest/dist/material-components-web.css https://unpkg.com/material-components-web@latest/dist/material-components-web.js
What browser(s) is this bug affecting?
Chrome
Version 59.0.3071.115 (Official Build) (64-bit)
What OS are you using?
macos sierra, and windows 10.
What are the steps to reproduce the bug?
- npm install -g create-react-app
- git clone https://github.com/smandava/router-issue
- cd router-issue
- npm i
- npm start
- open http://localhost:3000 on your browser
- open developer tools and network tab
- click on About link, network tab shows about 12 requests made to the server to render the page (actual behaviour)
- open app.js in a text editor.
- replace BrowserRouter with HashRouter and save the file.
- open http://localhost:3000 on your browser
- open developer tools and network tab
- click on About link, you see the No network requests but the link is still functional. (expected behaviour).
What is the expected behavior?
Described in (12) above.
What is the actual behavior?
Described in (7) above.
Any other information you believe would be useful?
None.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:10 (4 by maintainers)
Top Results From Across the Web
MUI Drawer not rendering with React-router-dom v6
So I configured in my index.js the different routes using react-router-dom@v6. I can access my pages by entering the link directly in the...
Read more >Migrating to React Router v6: A complete guide
Migrate your React Router applications from v5 to v6 with this in-depth guide, including a review of additions and improvements from v5.
Read more >Navigation in React App using React Router (v6)
Now run the application and navigate through the links and you should be able to see the appropriate components being rendered. Basic Routing....
Read more >React & Material UI #21: Drawer & Drawer + React Router
In this video we go over:- The 3 Material UI Variants within React - MUI Drawer props- How the Drawer works with List...
Read more >Material-UI Drawer + React Router Tutorial (Navigation in React)
Learn how to create a React application using Material-UI for style & react router to handle routing.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had this same issue. This is my workaround until something gets implemented:
This has been fixed via 3e173e1ddc3bff5c7c9c2d794eeb36a9354ec98c (based on #1138), which refactors out the
stopPropagation
call.