Replies: 3 comments
-
Related proposal: #4433 |
Beta Was this translation helpful? Give feedback.
0 replies
-
BTW: I tried using I eventually punted and used the technique implemented in |
Beta Was this translation helpful? Give feedback.
0 replies
-
With Single Fetch using turbo-stream and supporting more advanced types like Date, Map, etc. this is not needed anymore. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Proposal
Background
JSON.stringify
has an option to pass areplacer
function, this function is used to customize howJSON.stringify
convert a value to a JSON compatible value (e.g. convert Date to a string).JSON.parse
has also an option to pass areviver
function, this function is used to customize howJSON.parse
convert certain keys from the JSON string to the actual values (e.g. convert an date string to an actual Date).Use Cases
API/Examples
Open questions
{ __type: "Date", value: value.toISOString() }
Prior Art
json
,useLoaderData
anduseActionData
support doing this by calling JSON.stringify two times so Remix hooks received a string and then using JSON.parse it converted it back to an object.Beta Was this translation helpful? Give feedback.
All reactions