Handling dynamic routes
See original GitHub issueUsing React-snap with React Router (5.1.5)
<Switch> <Route path="page/:id"> <Page /> </Route> <Route path="page"> <Page /> </Route> </Switch>
After the build, it creates page.html so I page without params works (http://url/page). However, if I try something like this http://url/page/3, I get 404 page.
How can I make the dynamic routes work?
Edit: Normally using HashRouter instead of BrowserRouter solves the problem without SSR.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:7
Top Results From Across the Web
Dynamic Routes - Next.js
Dynamic Routes are pages that allow you to add custom params to your URLs. ... Client-side navigations to dynamic routes are handled with...
Read more >Routing in Next.js – How to Set Up Dynamic Routing with Pre ...
In this tutorial, you'll learn how to set up dynamic routing in Next.js. You'll also learn about pre-rendering and why it's important.
Read more >A Beginner's guide to Dynamic Routing in Next.js - Marie Starck
Tutorial on Next.js Dynamic Routing. How to create routes and navigate between pages with Link, useRouter and withRouter (next/link and ...
Read more >Get Data using Dynamic Routes in React - DEV Community
One of the most common needs we all have is consuming data in the frontend dynamically and one of the solutions is the...
Read more >Handling Dynamic Routes Without a Server - Stack Overflow
"I think this architecture demands that there's either a server to handle route redirects or a SPA framework." — No, it demands that...
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 Free
Top 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
How would this work if we dont know the dynamic link path?
for example /download/slug*
where slug is a 5 digit random sequence of letters
I’m not sure how react-snap will create a index.html in a /download/??? folder ?
@BrightonNgema thanks for the answer! As I have an album component and each image is a route to a store (in an e-mall) the following worked:
<Link to={'/' + yourUrl} style={{display: 'none'}}>linkToStore</Link>