Skip to content

Commit

Permalink
Merge branch 'main' into bug-2738
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi authored Oct 15, 2024
2 parents b3a7793 + cb6dc0e commit 79adf23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/guides/performance.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Dont's:
```jsx
const Profile = () => {
const [name] = useAtom(nameAtom)
const [ageAtom] = useAtom(ageAtom)
const [age] = useAtom(ageAtom)
return (
<>
<div>{name}</div>
Expand Down
3 changes: 2 additions & 1 deletion docs/utilities/storage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ const storedAtom = atomWithStorage('stored-key', content, storage)

#### Notes with AsyncStorage (since v2.2.0)

If you use any kinds of AsyncStorage, the atom value can become async. Hence, if you are to update the value, you need to possibly resolve the promise.
With AsyncStorage (as with any asynchronous storage), the atom value becomes async.
When updating the atom by referencing the current value, then you'll need to `await` it.

```js
const countAtom = atomWithStorage('count-key', 0, anyAsyncStorage)
Expand Down

0 comments on commit 79adf23

Please sign in to comment.