Skip to content

Commit

Permalink
feat(withAtomEffect): add withAtomEffect to export
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaskasky committed Sep 16, 2024
1 parent fa0f231 commit 7259985
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ const loggingAtom = withAtomEffect(anAtom, (get, set) => {
})
```


## Comparison with useEffect

### Component Side Effects
Expand Down
2 changes: 2 additions & 0 deletions __tests__/withAtomEffect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ describe('withAtomEffect', () => {
store.sub(enhancedAtom, () => {})
store.set(enhancedAtom, 5)
expect(store.get(enhancedAtom)).toBe(5)
store.set(enhancedAtom, (prev) => prev + 1)
expect(store.get(enhancedAtom)).toBe(6)
})

it('calls effect on initial use and on dependencies change', async () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jotai-effect",
"description": "👻🔁",
"version": "1.0.2",
"version": "1.0.3",
"author": "David Maskasky",
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { atomEffect } from './atomEffect'
export { withAtomEffect } from './withAtomEffect'

0 comments on commit 7259985

Please sign in to comment.