I'm using v2 routing, my file are name like: pagename._index.jsx. I have 2 other pages that use the same naming conventions that work fine. im using Links from react router like this : <Link to='/' className="nav-button"><h1>69BEATS</h1></Link> <Link to='/beats' className="nav-button"><h1>BEATS</h1></Link> <Link to='/producers' className="nav-button"><h1>PRODUCERS</h1></Link>The only thing i am doing differently on the route that doesnt work is using a loader. when i type in the route manually (127.0.0.1/routename) it works flawlessly.
#Link routing not working.
1 messages · Page 1 of 1 (latest)
when i remove the loader function from the route, the route loads as usual
this is the response i get when i try to click the link GET /beats?_data=routes%2Fbeats%2Findex 200 - - 12.715 ms
same outcome when using v1
It's hard to say without viewing the code. But are there any errors in the browsers console when clicking the link? Perhaps there is something wrong when the beats route is rendering on the client (and not when rendering on the server) since it works to load the route with a hard refresh.
no errors on the client either. here is a link to the code: https://github.com/xxCosta/69beats/tree/main/remix3
i think it may have something to do with express. I will try using the stock remix server next.
Haven't used redis before, so just a long shot, but should the return from the beats route be return json(retBeats) instead of just return (retBeats)? You should be able to inspect the response in the network tab in your browser and see if it lookes correct.
Unfortunately I already tried this. I’m having no issue with getting the data from the loader, if I manually type in the route in the browser it works, just the link functionality isn’t working. I had this issue prior from to moving from returning json object to returning a js array: https://github.com/xxCosta/69beats/commit/1eff555caec4fb4193e3b2485963de6e63440d81 .As per the network tab, after I click the link it shows it tries loading the page but after about 0.5 seconds it changes and loads the same page I’m on. I’ll post a screen recording of what’s happening . Thanks for trying to help, I appreciate it.
I was able to get it to work and answered on GitHub https://github.com/remix-run/remix/discussions/7192
as someone new to react router and express, does having a file name like you mentioned, 'pagename._index.jsx', normal?
Yes 😅
it's a nested route: https://remix.run/docs/en/main/file-conventions/route-files-v2#nested-routes index