#Navbar authenication in ReactJs

26 messages · Page 1 of 1 (latest)

cyan pond
#
<div>
    {  auth ?
  
    <nav className="nav-ul navbar navbar-dark bg-zinc-800 fixed w-full top-0 z-10">
      <div className="container flex sm:flex-row flex-col gap-2 justify-between items-center">
        <h1 className="fs-3">
          <Link to='/' className="text-white ">
              <span className="hover:text-blue-600">Music Essentials</span>
          </Link>
        </h1>
        <div className="flex items-center gap-4">
          <ul className="flex items-center gap-5 text-white">
            <li>
              <a href="/home">Home</a>
            </li>
            <li>
              <div className="dropdown-menu">
                <Link to="/music">
                  Music
                </Link>
                <div className="menu-content">
                  <a className="links-hidden" href="/genre">
                    Pop
                  </a>
                  <a className="links-hidden" href="/Hiphop">
                    Hip Hop
                  </a>
                  <a className="links-hidden" href="/Rock">
                    Rock
                  </a>
                  <a className="links-hidden" href="/EDM">
                    EDM
                  </a>
                  <a className="links-hidden" href="/RandB">
                    R&B
                  </a>
                  <a className="links-hidden" href="/Jazz">
                    Jazz
                  </a>
                </div>
              </div>
            </li>
            <li>
              <Link to="/Store">
              Store
              </Link>
            </li>
            <li>
              <a href="/News">News</a>
            </li>
            <li>
              <a href="/Contact">Contact</a>
            </li>

          </ul>
          {/* <div></div> */}
        </div>
      </div>
    </nav>
   : 

#
      <div className="container flex sm:flex-row flex-col gap-2 justify-between items-center">
        <h1 className="fs-3">
          <Link to='/' className="text-white ">
              <span className="hover:text-blue-600">Music Essentials</span>
          </Link>
        </h1>
        <div className="flex items-center gap-4">
          <ul className="flex items-center gap-5 text-white">
            <li>
              <a href="/">Home</a>
            </li>
            <li>
              <div className="dropdown-menu">
                <Link >
                  Music
                </Link>
                <div className="menu-content">
                  <a className="links-hidden">
                    Pop
                  </a>
                  <a className="links-hidden" >
                    Hip Hop
                  </a>
                  <a className="links-hidden">
                    Rock
                  </a>
                  <a className="links-hidden" >
                    EDM
                  </a>
                  <a className="links-hidden">
                    R&B
                  </a>
                  <a className="links-hidden" >
                    Jazz
                  </a>
                </div>
              </div>
            </li>
            <li>
              <Link>
              Store
              </Link>
            </li>
            <li>
              <a>News</a>
            </li>
            <li>
              <a >Contact</a>
            </li>

          </ul>
          {/* <div></div> */}
        </div>
      </div>
    </nav>
  
  
  }

    
    </div>

  );```
#

so I am having issue with showing the first navbar content before : character for when the user logs into the site they will be able to access the link rather than after my second : nav content. How to fix this issue?

ruby forum
cyan pond
#

yes only one showing

#

i want the right navbar to show when the user logs in home page

#

i want the other one to show before the user logs in on the /signin page

ruby forum
cyan pond
cyan pond
ruby forum
#

Well auth is logging null all the time

#

I would try and sort out these errors first

#

Also not sure how to install modules here

cyan pond
#

yes

#

its null to install them just refresh the bottom left corner

ruby forum
#

Okay yeah I would get your app and router set up as those are causing issues.

#

You cant use Link outside of a router

cyan pond
#

the links work perfectly fine

#

one shows links and the other I deleted the links

ruby forum
#

I get these errors

#

I dont really see how they could work since there is no router provider

cyan pond
cyan pond
ruby forum
cyan pond
#

Ok just a second, try rejoining