DEV Community

Mayank Kumar Chaudhari
Mayank Kumar Chaudhari

Posted on

Answer: Next.js server component when converting to client component giving issues

You can not have async effect. Thus you need to do following

 useEffect(() => {
    getPosts().then(data => setPosts(data))
  }, [])

Update:

As per the updated question. I notice that you are using Server component PostCard as a child of client component. This is the cause of the error. All…

Top comments (0)