Re:Just Normal Web Things
by paulddraper on Saturday August 05, 2023 @10:46PM
(#37018488)
?
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.
Re:Just Normal Web Things
by jakelazaroff on Saturday August 05, 2023 @11:54PM
(#37018852)
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.
Re:Just Normal Web Things
by paulddraper on Sunday August 06, 2023 @12:47PM
(#37023866)
Sorry, RouterLink for Angular, NavLink for React router.
Re:Just Normal Web Things
by matheusmoreira on Sunday August 06, 2023 @12:58AM
(#37019105)
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.
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.