You're importing a component that needs usePathname. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default. #40
UsePathname in Sidebar component is throwing this error;
Error:
× You're importing a component that needs usePathname. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.
│ Learn more: https://nextjs.org/docs/getting-started/react-essentials
│
│
╭─[/Users/mriccelli75/Sites/jsm_banking/components/Sidebar.tsx:4:1]
4 │ import Link from 'next/link'
5 │ import Image from 'next/image'
6 │ import { sidebarLinks } from '@/constants'
7 │ import { usePathname } from 'next/navigation'
· ───────────
8 │
9 │
10 │ const Sidebar = ({user}: SiderbarProps) => {
╰────
UsePathname in Sidebar component is throwing this error;
Error: × You're importing a component that needs usePathname. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default. │ Learn more: https://nextjs.org/docs/getting-started/react-essentials │ │ ╭─[/Users/mriccelli75/Sites/jsm_banking/components/Sidebar.tsx:4:1] 4 │ import Link from 'next/link' 5 │ import Image from 'next/image' 6 │ import { sidebarLinks } from '@/constants' 7 │ import { usePathname } from 'next/navigation' · ─────────── 8 │ 9 │ 10 │ const Sidebar = ({user}: SiderbarProps) => { ╰────