The code that I put in console.log() to show the page path only appears in the “pages.tsx” file (src/app/pages.tsx) and the others that are in (src/page/Login) are not appearing in the console.
layout.tsx code:
'use client';
import { Inter } from 'next/font/google';
import { usePathname } from 'next/navigation';
import './globals.css';
import { checkIsPublicRoute } from '@/functions/check-is-public-route';
const inter = Inter({ subsets: ['latin'] })
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
const pathname = usePathname();
console.log("caminho:", pathname)
const isPublicPage = checkIsPublicRoute(pathname!)
console.log(isPublicPage)
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
)
}
When I navigate between the pages I created, nothing appears in the end but on the main page of next it appears:
caminho: /
layout.tsx:19 false
layout.tsx:17 caminho: /
layout.tsx:19 false
layout.tsx:17 caminho: /
layout.tsx:19 false
layout.tsx:17 caminho: /
layout.tsx:19 false
Regardless of the route I take, it doesn’t capture what the layout is defining

