import { usePrevious } from "@lynx-js/react-use";
const Demo = () => {
const [count, setCount] = React.useState(0);
const prevCount = usePrevious(count);
return (
<view>
<view bindtap={() => setCount(count + 1)}>+</view>
<view bindtap={() => setCount(count - 1)}>-</view>
<text>
Now: {count}, before: {prevCount}
</text>
</view>
);
};