DEV Community

Mayank
Mayank

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)); 
  }, [])

Top comments (0)