react-tweet icon indicating copy to clipboard operation
react-tweet copied to clipboard

Serialize the tweet to avoid client error

Open Dhravya opened this issue 1 year ago • 0 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?

Dhravya avatar Dec 25 '23 23:12 Dhravya