Skip to content

Commit

Permalink
docs: warn about usage of Provider inside Suspense (#1142)
Browse files Browse the repository at this point in the history
* docs: warn about usage of `Provider` not containing `Suspense`

* docs: add note about what could happen if `Provider` contains no `Suspense`
  • Loading branch information
macarie authored May 6, 2022
1 parent 3f7d555 commit 17de495
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/basics/async.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Async support is first class in jotai. It fully leverages React Suspense.
## Suspense

To use async atoms, you need to wrap your component tree with `<Suspense>`.
If you have `<Provider>`, place at least one `<Suspense>` inside the `<Provider>`.

> If you have a `<Provider>`, place **at least one** `<Suspense>` inside said `<Provider>`; otherwise, it may cause an endless loop while rendering the components.
```jsx
const App = () => (
Expand Down

1 comment on commit 17de495

@vercel
Copy link

@vercel vercel bot commented on 17de495 May 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.