Hacker News new | ask | show | jobs
by cmiller1 851 days ago
I haven't used React so I had to look this up to realize he's talking about how it repurposes the <link> tag, but I've written HTML since the HTML4 days and "<a> doesn't swap nor replace your page content, it loads an entirely new page" doesn't even sound right to me.

<a href="#something"> always scrolled the page to a different part of the contents, <a href="javascript:something"> always ran javascript without loading an entirely new page, and <a href="something.html" onclick="something"> runs some javascript and won't load a new page if something returns false. That last one even seems purpose built to let you load in content ajax style with a fallback to a standard page load if the user's browser doesn't support it.

2 comments

It doesn't actually repurpose the <link> tag. In React, all componentes start with upper-case to avoid collision with standard HTML. So the link tag is <Link>. If you typed <link> you would get regular HTML <link>, which thinking about it now, probably confuses a lot of people who know React but not HTML.
You're right, and the thing is React/FE Frameworks doesn't even repurpose the <link> tag. It doesn't replace or edit any native tags.

There are some _libraries_ that _create_ a <Link> tag, which is basically a 'wrapper' that adds its own set of logic, but it's a new tag.