From 7024da8be348982e6f884df91a3733d8c37f81c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Jablo=C3=B1ski?= <43938777+GermanJablo@users.noreply.github.com> Date: Wed, 19 Feb 2025 10:52:53 -0300 Subject: [PATCH] =?UTF-8?q?docs:=20fix=20variable=20name=20typo=20in=20use?= =?UTF-8?q?PayloadAPI=20(error=20=E2=86=92=20isError)=20(#11249)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/admin/react-hooks.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/admin/react-hooks.mdx b/docs/admin/react-hooks.mdx index fed43ea05..391a58447 100644 --- a/docs/admin/react-hooks.mdx +++ b/docs/admin/react-hooks.mdx @@ -1054,13 +1054,13 @@ import { usePayloadAPI } from '@payloadcms/ui' const MyComponent: React.FC = () => { // Fetch data from a collection item using its ID - const [{ data, error, isLoading }, { setParams }] = usePayloadAPI( + const [{ data, isError, isLoading }, { setParams }] = usePayloadAPI( '/api/posts/123', { initialParams: { depth: 1 } } ) if (isLoading) return

Loading...

- if (error) return

Error: {error.message}

+ if (isError) return

Error occurred while fetching data.

return (
@@ -1094,7 +1094,7 @@ The first item in the returned array is an object containing the following prope | Property | Description | | --------------- | -------------------------------------------------------- | | **`data`** | The API response data. | -| **`error`** | If an error occurs, this contains the error object. | +| **`isError`** | A boolean indicating whether the request failed. | | **`isLoading`** | A boolean indicating whether the request is in progress. | The second item is an object with the following methods: