How to import state from redux slices as different variables?

Viewed 35

I have notification component which shows state of queries, so I need to import all states as different names in cause of many variables with same names

const { loading, success, error } = useAppSelector(state => state.messageReducer)
const { loading, success, error } = useAppSelector(state => state.offerReducer)

I want to do it like destructuring works:

const { customName, customName1, customName2 } = {loading, success, error}
1 Answers
const { loading : basketLoading, success : basketSuccess, error: basketError } = useAppSelector(state => state.basketReducer)

It was pretty easy...

Related