我正在尝试将当前状态重置为初始状态。但是我所有的尝试都没有成功。我如何使用 redux-toolkit 来做到这一点?
const slice = createSlice({
name: 'tweets',
initialState: {
byTweetId: {},
byUserId: {},
allTweetIds: [],
},
// reducers
reducers: {
// reset: (state) => Object.assign(state, initialState),
tweetStoreReseted: (state) => {
//here I need to reset state of current slice
},
},
});