Skip to content

Commit

Permalink
Update to version 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
David Maskasky committed Sep 16, 2024
1 parent 814e485 commit ec068c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { withHistory } from 'jotai-history'
const countAtom = atom(0)
const countWithPrevious = withHistory(countAtom, 2)
export function CountComponent() {
function CountComponent() {
const [count, previousCount] = useAtomValue(countWithPrevious)
const setCount = useSetAtom(countAtom)
Expand Down Expand Up @@ -76,8 +76,13 @@ import { withUndo } from 'jotai-history'
const counterAtom = atom(0)
const undoCounterAtom = withUndo(counterAtom, 5)
export function CounterComponent() {
const { undo, redo, canUndo, canRedo } = useAtomValue(undoCounterAtom)
function CounterComponent() {
const {
undo,
redo,
canUndo,
canRedo,
} = useAtomValue(undoCounterAtom)
const [value, setValue] = useAtom(counterAtom)
return (
Expand All @@ -96,7 +101,7 @@ export function CounterComponent() {
```

## Example
https://codesandbox.io/p/sandbox/musing-orla-g6qj3q?file=%2Fsrc%2FApp.tsx%3A10%2C23
https://codesandbox.io/p/sandbox/musing-orla-g6qj3q

## Memory Management

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-history",
"description": "👻⌛",
"version": "0.2.0",
"version": "0.2.1",
"author": "David Maskasky",
"repository": {
"type": "git",
Expand Down

0 comments on commit ec068c2

Please sign in to comment.