Skip to content

Commit ddf4eef

Browse files
add info about "data" method to json deprecation annotation (#10483)
Co-authored-by: Matt Brophy <[email protected]>
1 parent 03d8dd7 commit ddf4eef

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@
707707
- willhack
708708
- willin
709709
- willowcheng
710+
- willsmithte
710711
- wizardlyhel
711712
- wKovacs64
712713
- wladiston

packages/remix-server-runtime/responses.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,13 @@ export type TypedResponse<T = unknown> = Omit<Response, "json"> & {
4343
*
4444
* @deprecated This utility is deprecated in favor of opting into Single Fetch
4545
* via `future.v3_singleFetch` and returning raw objects. This method will be
46-
* removed in React Router v7. If you need to return a JSON Response, you can
47-
* use `Response.json()`.
46+
* removed in React Router v7.
47+
*
48+
* If you need to return custom headers or status code, you can use the new `data`
49+
* utility (https://remix.run/docs/en/main/utils/data).
50+
*
51+
* If you need to return a JSON Response from a resource route, you can use
52+
* `Response.json` (https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static).
4853
*
4954
* @see https://remix.run/utils/json
5055
*/

0 commit comments

Comments
 (0)