Closed tmanager2025 closed 7 months ago
HI @tmanager2025,
Sorry for the confusion! You'll need to use the useStore
from zustand to make the temporal selector reactive. Maybe I can update the docs to avoid confusion.
Add this to your <App />
function:
const { undo, redo, futureStates, pastStates, clear } = useStore(
useMyStore.temporal,
);
Here's a sandbox: https://codesandbox.io/p/sandbox/zundo-forked-l9dl2s
Sorry can't open the sandbox. Giving below message.
[Back to the dashboard](https://codesandbox.io/dashboard)
Sandbox not found
It's likely that the Sandbox you're trying to access doesn't exist or you don't have the required permissions to access it.
If the issue persists, please contact our support team at [support@codesandbox.io](mailto:support@codesandbox.io) for further assistance, making sure to copy the error details below.
Problem details and configurations
Review GitHub permissions
Show details
Ok I am able to work. Thank you so much 😊
For anyone looking below is updated sandbox.
https://codesandbox.io/p/sandbox/zundo-forked-3sjgk9?file=%2Fsrc%2FApp.tsx%3A17%2C27
the
clear
function is not working. Sandbox: https://codesandbox.io/p/sandbox/zundo-forked-3sjgk9Code: