Replies: 2 comments
-
In React Router v7 there is a new When no custom status codes or headers are needed, raw objects can be returned from loaders/actions. |
Beta Was this translation helpful? Give feedback.
-
There’s also |
Beta Was this translation helpful? Give feedback.
-
Hi!
When using future.v7_skipActionErrorRevalidation the json() method has the nice utility of altering response status to 4xx/5xx without the need to explicitly create the response yourself (providing the ability to opt-out of revalidation in case of an error submitting some data etc.).
It also provides a convenient way to require returned data to conform to a given type.
The alternatives i see for typing is probably using "satisfies".
But with that and the revalidation opt-out i see myself recreating the json() method myself, and therefore would be interested to hear the reason why it is beeing deprecated.
Beta Was this translation helpful? Give feedback.
All reactions