Open shahreaz0 opened 1 month ago
This is probably opinionated, but I'd suggest to use produce
.
import { create } from 'zustand';
import { createSlice, withSlices } from 'zustand-slices';
import { produce } from 'immer';
const countSlice = createSlice({
name: 'count',
value: 0,
actions: {
inc: () => produce((draft) => { ++draft }),
reset: () => () => 0,
},
});
Like this![Screenshot_2024-05-25-20-33-41-74_f9ee0578fe1cc94de7482bd41accb329.jpg](https://github.com/zustandjs/zustand-slices/assets/44563789/f72fc84c-1f5d-46aa-afad-ffcfaf421166)