How to enable the use of <a> tag in Next.js?

Viewed 932

I don't want to use <Link> from next. I've been researching how to disable this, but I can't.

I want to disable this and use the default html tag <a>.

It doesn't let me deploy, it keeps giving error because of that.

Can anyone help me?

The error I get:

12:9 Error: Do not use the HTML tag to navigate to /. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages @next/next/no-html-link-for-pages

2 Answers

You can disable the @next/next/no-html-link-for-pages ESLint rule in your .eslintrc file.

{
  // ...
  "rules": {
    // Other rules
    "@next/next/no-html-link-for-pages": "off"
  }
}

Note that the above is not recommended, as using <a> elements instead of the next/link component will disable client-side route transitions between pages. This means all pages will be loaded from the server.

I guess you're trying to navigate to home. You can try: <a href="https://(your app home path)">Home</a> Instead of: <a href="/">Home</a>

Related