Replies: 1 comment
-
It doesn’t seem to be available in React Router v6, but in React Router v7 (prerelease) 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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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