React App stops working on anchor tags and Link components

Quick note for anyone who might run into the same issue I did.

If your React – Redux – Router app suddenly stops working properly, and by that I meant, it mysteriously stops following anchor tags (<a>) or Link components (<Link>) properly (in my case the browser got redirected back to home (/#), then: make sure that you are at least NOT using react-router 2.8.1.

I haven’t got the time to test this out with many different react-router versions, but I’m definitely sure 2.8.1 and 2.6.1 didn’t work for me. After switching to 3.0.0, things worked normally again.


Why the fuss, you asked?

Thing is, I started with react-router 1.0.0-rc3, then moved on to 2.x at some point. Once in a while I run npm update --save , however in general I don’t pay that much attention to the versioning of my react-router (or other deps) – I know, fml right? – So after some updates, I ended up with 2.8.1, which didn’t work, and it took me roughly 1/3 of a day to find out the culprit. Figured by jotting this down here, I may save a few hours of head scratching for someone out there.

It’s also worth noting the other related deps at the time:

"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-redux": "^4.4.6",
"redux": "^3.6.0"

If anyone could help shed more light on this, beer on me  🙂

Over and out.

Reblogged from this, with permission.

Illustration photo by Erwan Hesry on Unsplash

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s