Skip to content

Commit

Permalink
docs: fix dispatchAtom example (#2284)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benson authored Nov 30, 2023
1 parent 06442d3 commit 3e68ccc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/guides/composing-atoms.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ You can also create an action atom that will call another action atom:
export const dispatchAtom = atom(null, (_get, set, action) => {
if (action === 'INC') {
set(incAtom)
}
if (action === 'DEC') {
} else if (action === 'DEC') {
set(decAtom)
} else {
throw new Error('unknown action')
}
throw new Error('unknown action')
}
})
```
Why do we want it? Because it will be used only when needed.
Expand Down

1 comment on commit 3e68ccc

@vercel
Copy link

@vercel vercel bot commented on 3e68ccc Nov 30, 2023

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.