Skip to content

Commit

Permalink
docs: update isLoading to isPending to be more consistent with RQ docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kalijonn committed Dec 11, 2023
1 parent bc9c1fb commit f6790cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ You can incrementally adopt `jotai-tanstack-query` in your app. It's not an all

```jsx
# existing useQueryHook
const { data, isLoading, isError } = useQuery({
const { data, isPending, isError } = useQuery({
queryKey: ['todos'],
queryFn: fetchTodoList
});
Expand All @@ -49,7 +49,7 @@ You can incrementally adopt `jotai-tanstack-query` in your app. It's not an all
queryKey: ['todos'],
}))

const [{ data, isLoading, isError }] = useAtom(todosAtom)
const [{ data, isPending, isError }] = useAtom(todosAtom)

```

Expand Down Expand Up @@ -413,7 +413,7 @@ In the previous version of `jotai-tanstack-query`, the query atoms `atomsWithQue
#### atomWithQuery and atomWithInfiniteQuery

- `dataAtom` was used to access the actual data (`TData`).
- `statusAtom` provided the status object (`QueryObserverResult<TData, TError>`), which included additional attributes like `isLoading`, `isError`, etc.
- `statusAtom` provided the status object (`QueryObserverResult<TData, TError>`), which included additional attributes like `isPending`, `isError`, etc.

In v0.8.0, they have been replaced by `atomWithQuery` and `atomWithInfiniteQuery` to return only a single `dataAtom`. This `dataAtom` now directly provides the `QueryObserverResult<TData, TError>`, aligning it closely with the behavior of Tanstack Query's bindings.

Expand All @@ -425,7 +425,7 @@ To migrate to the new version, replace the separate `dataAtom` and `statusAtom`
- const [status] = useAtom(statusAtom);

+ const dataAtom = atomWithQuery(/* ... */);
+ const [{ data, isLoading, isError }] = useAtom(dataAtom);
+ const [{ data, isPending, isError }] = useAtom(dataAtom);
```

#### atomWithMutation
Expand Down

0 comments on commit f6790cb

Please sign in to comment.