Skip to content

Commit

Permalink
chore: add subscribeCallback logger to example
Browse files Browse the repository at this point in the history
  • Loading branch information
lwhiteley committed Jan 9, 2024
1 parent dd0bb77 commit 20dbf8f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions examples/typescript-001/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ import { useSnapshot } from 'valtio';
import { proxyWithHistory } from 'valtio-history';
import React from 'react';

const textProxy = proxyWithHistory({
text: 'Add some text to this initial value and then undo/redo',
});
const textProxy = proxyWithHistory(
{
text: 'Add some text to this initial value and then undo/redo',
},
{
subscribeCallback: (ops, historySaved) =>
console.log({ ops, historySaved }),
}
);
const update = (event: React.ChangeEvent<HTMLTextAreaElement>) =>
(textProxy.value.text = event.target.value);

Expand Down

0 comments on commit 20dbf8f

Please sign in to comment.