I have a component that contains inside it (as children) content that needs to boost SEO. Here’s a snippet of my code:
<AnimatedElement className="flex flex-col justify-start items-center gap-4 w-full" duration={500}>
<h2 className={montserratBoldFont.className + " font-bold text-4xl text-black text-left"}><span className='text-ac-violet'>Find</span> Us</h2>
<Image src="/Homepage/hand-drawn-arrow.png" width={96} height={96} alt='' />
<p className={latoFont.className + " font-medium text-sm xm:text-base leading-5 text-center text-white"}>
{homepage.formations}
</p>
</AnimatedElement>
In the current page, I didn’t put a "use client"
directive, but inside the AnimatedElement
component, I added "use client"
.
So my question is wether or not the "children" are under the effect of "use client"
?
2
Answers
Children of
AnimatedElement
are client components, or are in effect of "use client" directive.In fact, you can use the server component in "use client" without it being "degraded" to a client component. You can find the corresponding explanation in the documentation.
https://nextjs.org/docs/getting-started/react-essentials#composing-client-and-server-components