Search code examples
htmlreactjshyperlinkhref

Why is my href directory not working in my reactjs project?


I am trying to go to this file when the "Join Now" button is clicked but it doesn't seem to be working. As you can see on line 9 in the image below, I have an href for '/auth/login' and it is not working when I click on the button 'Join Now' but rather nothing comes up. I have tried different directories such as '/src/app/auth/login' and it is still not working. I think it is definitely an easy fix but I am a beginner and lost. Any tips would be greatly appreciated.

My code and specifically my href on line 9


Solution

  • /auth/login is not routable, check out the doc here: https://nextjs.org/docs/app/building-your-application/routing/colocation

    1. put your component folder into the src folder

    2. try this folder structure under auth: auth/ login/ page.js

      where the page.js content should be your current login.js content