Skip to content

Commit

Permalink
docs(npm-react): use reatomReactiveAsync instead of reatomAsyncReaction
Browse files Browse the repository at this point in the history
  • Loading branch information
BANOnotIT committed Oct 1, 2023
1 parent 53b3708 commit 7267266
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/npm-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,14 @@ export const MyForm = () => {
## Use atom promise
If you have an atom with a promise and want to use its value directly, you could use `useAtomPromise`. This function relies on [React Suspense](https://react.dev/reference/react/Suspense) and throws the promise until it resolves. It can be useful with [reatomAsyncReaction](https://www.reatom.dev/package/async/#reatomasyncreaction).
If you have an atom with a promise and want to use its value directly, you could use `useAtomPromise`. This function relies on [React Suspense](https://react.dev/reference/react/Suspense) and throws the promise until it resolves. It can be useful with [reatomReactiveAsync](https://www.reatom.dev/package/async/#reatomreactiveasync).
```tsx
import { atom, reatomAsyncReaction } from '@reatom/framework'
import { atom, reatomReactiveAsync } from '@reatom/framework'
import { useAtom, useAction, useAtomPromise } from '@reatom/npm-react'

const pageAtom = atom(1, 'pageAtom')
const listReaction = reatomAsyncReaction(async (ctx) => {
const listReaction = reatomReactiveAsync(async (ctx) => {
const page = ctx.spy(pageAtom)
const response = await ctx.schedule(() => fetch(`/api/list?page=${page}`))
if (!response.ok) throw new Error(response.statusText)
Expand Down

0 comments on commit 7267266

Please sign in to comment.