In Redux Toolkit, you can create actions that are not directly associated with a slice by using the createAction utility. This is useful when actions are shared across multiple slices or handled only by extra reducers.
When multiple slices need to respond to the same action.
When you want a standalone action not tied to any slice logic.
When using createReducer or extraReducers to handle shared updates.
Here, resetTodos is a standalone action that can be dispatched anywhere in the app. It’s not defined inside a slice but can still be handled by reducers or extraReducers as part of other slices.