I am experimenting with my code, and i was wondering if there was a cleaner way to combine the reducers with the combineReducers
function.
for example, in my current reducer setup i have:
productList: productListReducer,
productDetails: productDetailsReducer,
productDelete: productDeleteReducer,
productCreate: productCreateReducer,
productUpdate: productUpdateReducer,
productReviewCreate: productReviewCreateReducer,
productTopRated: productTopRatedReducer,
these are all individual pieces of state, as i understand it, and to access them you simply use the useSelector hook, for example if i wanted the productList
.
however what im thinking is perhaps a longshot but it would help keep the state more concise in my opinion. what im wanting to do is make it look like this:
product:
{
productList: productListReducer,
productDetails: productDetailsReducer,
productDelete: productDeleteReducer,
productCreate: productCreateReducer,
productUpdate: productUpdateReducer,
productReviewCreate: productReviewCreateReducer,
productTopRated: productTopRatedReducer,
},
where the state is a combination of all the reducers themselves, so then if i wanted anything out of product
like productList
then i would pull that out of state. My Goal with this is to keep things organized and easier to find in state. However with this current setup the state never shows up in the react-redux-devtools