I created a dynamic menu that is accessible to both public and registered users. The problem is that I have this:
{pages.length > 0 ? (
pages.map(page => (
<li key={page._id} className="nav-item">
{page._id ? (
<Link to={`pages/${page._id}`} className="nav-link">{page.title}</Link>
) : (
<Link to={`pages/${page._id}`} className="nav-link">Hola 2</Link>
)}
</li>
))
) : (
<li className="nav-item">
<a className="nav-link" href="#!">No Pages Found</a>
</li>
)}
Now when I'm in the homepage and a click a URL, the links works great:
localhost:3000/pages/5d2ea3a1ef0ba93f9cd1b980
Once I'm inside an URL, I try to click a different link and suddenly it now behaves like this:
localhost:3000/pages/pages/5d2ea3a1ef0ba93f9cd1b980
and so on:
localhost:3000/pages/pages/pages/5d2ea3a1ef0ba93f9cd1b980
Does anyone has an idea why is this happening?
<Link to={`/pages/${page._id}`} className="nav-link">Hola 2</Link>