Flatted vs JSON #270
|
On I'm asking because this leaves the impression that NRN users should always use this approach for any object that they need to return on their static props SSG/SSR functions. Have you considered to open up an issue on Next.js to suggest the usage of Flatted rather than Thanks. |
Replies: 1 comment 6 replies
Honestly, it should be a default. If you return dynamic data from Serializing the data using a safe serializer (e.g: Flatted) has several advantages:
I'm not sure the Next.js team would want to add it by default, but I strongly recommend it as soon as you forward dynamic data from the server to the client. |
Honestly, it should be a default. If you return dynamic data from
getServerSidePropsor similar, and if those data contain circular reference, you'll break your whole page for your customers.Serializing the data using a safe serializer (e.g: Flatted) has several advantages:
I'…