vercel / react-tweet

Embed tweets in your React application.

Home Page:https://react-tweet.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serialize the tweet to avoid client error

Dhravya opened this issue · comments

I'm encountering this error


Warning: Only plain objects can be passed to Client Components from Server Components. Classes or other objects with methods are not supported.

{: {lang: "en", reply_count: 9, retweet_count: ..., favorite_count: ..., possibly_sensitive: ..., created_at: ..., display_text_range: ..., entities: ..., id_str: ..., text: ..., user: ..., edit_control: ..., card: ..., isEdited: ..., isStaleEdit: ...}}

A simple fix would be to serialize the tweet like

data={JSON.parse(JSON.stringify(unit))}

and then showing it, in server components?