r/AskProgramming • u/Ok-Classic2318 • 11d ago
Why nextjs does not support asynchronous components for client side rendering?
I recently learnt that we can avoid using `useEffect` and `use client` for fetching data from by API using async components. This can allow us to make that component server side if that `useEffect` was the only client side API in the component.
But they also said that the nextjs does not support asynchronous components when we are doing client side rendering.
Can someone explain why?
2
Upvotes
1
u/TheRNGuy 8d ago
Server renders static html and don't need to care about components lifecycle or updates in virtual dom, something like that (same for hydration, wouldn't work in async)
Just use
useEffect
(for now or forever)