-
|
Regular routes can just return json like this |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Because For non-resource routes if your loaders/actions returns a plain JS object then RR is passing that to the With the latest release a PR was released that loosen this restriction allowing you to send raw JS objects, and it will pass it to |
Beta Was this translation helpful? Give feedback.
-
|
Glad to hear that resource routes and non-resource routes are moving toward parity! |
Beta Was this translation helpful? Give feedback.
Because
return { a: 1 }is not a response, is a JS object, you need to return a Response, theResponse.jsonhelps you create a new Response instance.For non-resource routes if your loaders/actions returns a plain JS object then RR is passing that to the
dataresponse helper.With the latest release a PR was released that loosen this restriction allowing you to send raw JS objects, and it will pass it to
Response.jsonor return it asplain/text.