diff --git a/docs/upgrading/v6.md b/docs/upgrading/v6.md index c1e536ed3f..3902d1af38 100644 --- a/docs/upgrading/v6.md +++ b/docs/upgrading/v6.md @@ -293,6 +293,18 @@ function shouldRevalidate({ actionStatus, defaultShouldRevalidate }) { } ``` +## Deprecations + +The `json` and `defer` methods are deprecated in favor of returning raw objects. + +```diff +async function loader() { +- return json({ data }); ++ return { data }; +``` + +If you were using `json` to serialize your data to JSON, you can use the native [Response.json()][response-json] method instead. + ## Upgrade to v7 Now that your app is caught up, you can simply update to v7 (theoretically!) without issue. @@ -354,3 +366,5 @@ Note you should use a top-level import for non-DOM contexts, such as Jest tests: Congratulations, you're now on v7! [react-flushsync]: https://react.dev/reference/react-dom/flushSync +[response-json]: https://developer.mozilla.org/en-US/docs/Web/API/Response/json +[data-util]: https://api.reactrouter.com/v7/functions/react_router.data.html