I noticed that when I have a parent component that is client side, these children are always client side too while I don’t use the ‘use client’ for child components. For what ? Is it possible to remedy this? ( i use nextjs 14 with app router)
example :
client parent component with ‘use client’ :
<div>
<div>
{(!isMobileContext) &&
<Nav offsetTopContext={offsetTopContext}></Nav>
}
{(isMobileContext) &&
<NavMobile offsetTopContext={offsetTopContext}></NavMobile>
}
</div>
<div>
{children}
</div>
<BannerPub/>
<Footer/>
</div>
)
}
server children component (bannerPub) without ‘use client’ but in reality is client component:
<div className="w-full mt-10 h-[35vh] relative flex flex-col justify-center items-center gap-4 pt-4 bg-[#05001F]">
<Image src={"/data/pub/WebRobBanner.webp"} alt={""} fill className="object-contain" />
<div className="absolute top-0 left-0 w-full bg-filter2 z-20" />
<div className="absolute flex flex-col top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 p-4 rounded-lg z-30">
<a className="inline-block text-base font-bold tracking-wider text-nowrap text-center transition-colors duration-300 bg-white hover:bg-blackbeautiful2 text-blackbeautiful2 hover:text-white rounded-full py-2 px-4 mb-2" href="tel:0610971019">Contactez-moi : 06 10 97 10 19</a>
<a className="inline-block text-base font-bold tracking-wider text-nowrap text-center transition-colors duration-300 bg-white hover:bg-blackbeautiful2 text-blackbeautiful2 hover:text-white rounded-full py-2 px-4" href="https://sebastien-petit-dev.com/" target="_blank">Site Web <b className="tracking-widest">SebaDev</b></a>
</div>
</div>
);
}