Skip to content
Discussion options

You must be logged in to vote

Hi,

The problem is that to pass data from Server Components to Client Components, the data must be serialisable.

In our world, frontend development, typically this means that the "data" has to be compliant to JSON transformations, that is from JavaScript Objects/Primitives to Strings.

The Date object is special because if you pass a Date object, into JSON.stringify, it gets casted as a string, but then if you try to recover the Date object by parsing, you get a string anyway, so the Date object is destroyed in the process.

let obj = {d : new Date()}
JSON.strin…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@Mic1
Comment options

@Luise8
Comment options

Answer selected by Mic1
Comment options

You must be logged in to vote
1 reply
@KQuiggins
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants