3 ms·
> But, everywhere are server components, it means, you can't use useState, useEffect and such client-function at all. It means, nextjs turns the SPA to refresh
by verdverm 2y ago
> But, everywhere are server components, it means, you can't use useState, useEffect and such client-function at all. It means, nextjs turns the SPA to refresh page.
You can pass client components to server components, and have access to hooks & effects. See
- https://nextjs.org/docs/app/building-your-application/rendering/client-components https://nextjs.org/docs/app/building-your-application/render...
- https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns https://nextjs.org/docs/app/building-your-application/render...
You are also not required to use server components with NextJS and you can use it as a better overall DX and simplifications like directory (convention) based routing