Hacker News new | past | comments | ask | show | jobs | submit login

At this point I wonder if browsers couldn't be adjusted to this, and have link behavior on any element that indirectly behaves like a link.

For instance if a user ctr + cliks a button, have the navigation happen in a tab window even if the URL change is pushed by a JS module down the line.




Would be better if browsers adjusted so as to deliberately break React and its brethren instead instead of fixing the mess they made. The web used to work great, now look at what it's become. People can't even put a link in the document properly.


?

You need a href for the browser to know where to navigate to.

Just use RouterLink.

It uses a native anchor tag. If you click (without Ctrl/cmd) it prevents default and does the navigation without reload.


What is RouterLink? A quick Google search turns up some Angular thing, but I don’t think anyone was talking specifically about Angular.


GP is talking about the component/feature present in React/Vue/Angular/etc routers that allows links to behave like normal anchor links (allowing to open in another window, etc) but also use the SPA router for navigation when possible.

I'm not making any argument here, just explaining. Also makeitdouble's idea would apply even to non-SPAs or to pages without javascript. For example, I might want to submit a form but in a new tab.


Sorry, RouterLink for Angular, NavLink for React router.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: