惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Hacker News
The Hacker News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
Recent Announcements
Recent Announcements
D
DataBreaches.Net
P
Proofpoint News Feed
V
Visual Studio Blog
J
Java Code Geeks
Recorded Future
Recorded Future
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
F
Full Disclosure
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
罗磊的独立博客
Jina AI
Jina AI
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
G
GRAHAM CLULEY
Y
Y Combinator Blog
L
LangChain Blog
L
LINUX DO - 热门话题
宝玉的分享
宝玉的分享
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Help Net Security
云风的 BLOG
云风的 BLOG
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园_首页
A
About on SuperTechFans
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Latest news
Latest news
T
Threatpost
T
Tenable Blog
有赞技术团队
有赞技术团队
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Stack Overflow Blog
Stack Overflow Blog
C
Cisco Blogs
C
Check Point Blog
T
Tor Project blog
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
美团技术团队
I
Intezer
S
Securelist
AWS News Blog
AWS News Blog

Software and Tech stories from an Insider - iDiallo.com

I turned my prologue into a short video The Laziest Generation All Chinese Models Will Be Illegal in 3... 2... 1... Everything you say CAN and WILL be used against you Happy Father's Day. I know Kung-fu Debugging on Prod I can never fully embrace LLMs for code ppclp.ai announces 100x Productivity Gains Why all the PRs? Now that your newsletter is AI-generated, I've Unsubscribed Now that your newsletter is AI-generated, I've Unsubscribed The web is changing, and we are not going back The web is changing, and we are not going back How Many Tokens Did You Burn Today How Many Tokens Did You Burn Today Amber Alert sends Spam URL? Amber Alert sends Spam URL? The commencement speech that shook the world The commencement speech that shook the world How to Talk to Your Coworkers How to Talk to Your Coworkers Don't call yourself a Software Engineer, and other Career Advice Don't call yourself a Software Engineer, and other Career Advice In the Empire's Defense In the Empire's Defense It's funny because it's true It's funny because it's true Software engineers are obsolete... for now We Are Not Going to Agree on AI Hi stranger
Please, use a link!
Ibrahim Diallo · 2026-06-11 · via Software and Tech stories from an Insider - iDiallo.com

This is a rant. It didn't start today, but I think I've reached the end of the line. The straw that broke the camel's back, so to say. I used an internal tool for the first time. I logged in and navigated through the web app, making some updates here and there. All was well. But then I made the mistake of wanting to go back to the initial dashboard. I clicked the back button, and instead of returning to the previous page, I saw Chrome's default tab page staring right back at me.

How is it possible? I had navigated through at least a dozen pages, yet one back button click and the web app was completely gone. If you've ever experienced something similar, it's probably because you were using a single-page app. Nothing wrong with single-page apps, of course, but over the years I've concluded that people who only know how to build single-page apps don't know what a link is.

So let's start with examples of what a link isn't.

<div onclick="navigate('home')">Home</div>

Not a link. It's a div with an onclick event handler. You can style it all you want, but it's not a link.

<button onclick="navigate('home')">Home</button>

This may be a button, but it is not a link. With the advent of React, this has become so common. Because it's called a button, learners naturally gravitate toward it to link different pages. But there is worse.

square hole

<a onclick="navigate('home')">Home</a>

This almost feels intentional. As if the developer is teasing me. Why would you use an anchor tag but then omit its most important attribute? Here is what a link is supposed to look like:

<a href="/home">Home</a>

That's it. Simple. You don't have to add any configuration for the browser to support it. You don't even have to style it. All user agents have sensible default styling for the different states of a link: unvisited, visited, and active. It works well with browser history. On desktop, when you hover over it, you get a preview of the destination URL in the bottom-left corner of your screen. On mobile, you can press and hold to get several options on how to open it. You don't even have to worry about accessibility. It just works.

But when a developer is deep in their React app thinking about functionality, they might say, "When you click this button, go to the home page." They will naturally think of onClick as an event. And since it's a single-page app, they're thinking about state, not a page. They might write something like this:

import { navigate } from 'somewhere'; 
function Home() {
  return (
    <div style={{ padding: '20px' }}>
      <h1>Home Page</h1>

      <button onClick={() => navigate('/about')}>
        Go to About Page
      </button>
      <div 
        onClick={() => navigate('/about')} 
        style={{ cursor: 'pointer', marginTop: '10px', color: 'blue' }}
      >
        Click this text to navigate
      </div>
    </div>
  );
}
export default Home;

This is already bad enough. But depending on how the navigate function is implemented, it can make or break the entire browser history. In the internal tool I was using, navigate was essentially replacing the current URL with the new one using location.replace().

You can avoid all of these issues by just using an anchor tag. If you need it to play nicely with your React app, React Router has a Link component.

import { Link } from 'react-router-dom';
function Navbar() {
  return (
    <nav>
      <Link to="/home">Home</Link>
    </nav>
  );
}

Please, just use a native link and you won't have to worry about anything else.