How to implement dynamic routes?
Hey I'm wondering how I would implement dynamic routes. I looked at some GitHub Discussion and found a Discord threat but it seems to not work for me.
I want to have a
/ index page and /issue/$id pages. /issue should just show a 404 page for now.
The index page was easy to implement, but I'm unsure how I implement the dynamic issue route. In my issue.tsx file I have an issue TSX component and a not found component. I then created these two routes:
In my issue component I can then use this to get the issue id:
In my main.tsx I register all routes:
I don't get any type errors, but when I start my application I get this error in the dev tools:
How do I correctly use dynamic routes?1 Reply
absent-sapphireOP•3y ago
i fixed it, if you have the same issue do the following:
add your dynamic route as a child route to the parent:
Remove the child route from the root route: