charkour / zundo

🍜 undo/redo middleware for zustand. <700 bytes
https://codesandbox.io/s/zundo-2dom9
MIT License
597 stars 19 forks source link

Local Storage with Zundo #131

Closed joaopedrosdmm closed 10 months ago

joaopedrosdmm commented 10 months ago

``Congrats. Great project.

I'm looking for a way to implement zundo with local storage.

I have the following code

export let useStore = create(
    persist(
       (set) => ({
            bear: {},

            addBear....
            ......
            ......
            ......
        }),
        {
            name: 'global', 
            getStorage: () => localStorage,
            //storage: () => localStorage.getItem('global', createJSONStorage),
        }
    )
)

And I would like to implement Zundo to this use case.

How should I go about doing this?

charkour commented 9 months ago

Let me know if you have any questions!