skip to Main Content

I just created a next.js app then when I try linking another page, it is 404, I read that it is a bug, but I don’t know how to fix it. upon creating the app, I don’t have the pages folder, I wrote the link on page.js,
image of the folders, files after you create the app

import Link from 'next/link'
export default function Home() {
  return (
    <><><div>
<Link href='./about'>test</Link> &nbsp;
<Link href={'about'}>ABout</Link> &nbsp;
<a href='/about'>anchor tag</a>
    </div>
    </></>
  )
}

what should i do to make it work? thanks

2

Answers


  1. Chosen as BEST ANSWER

    I've been saying yes to the src/ in the installation part. This solved my problem, I chose no to the 'src/' directory


  2. Post your actual code here instead of screenshots if you want quicker and better answers.

    For now, try adding a dot in front of your folder path and you have forgotten the extension in your file (.js). So the code should look like:

    <Link href="./about.js">Test</Link>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search