I have a redux store configured using redux-toolkit with two slices: products and cart.
export const store = configureStore({
reducer: {
products: productsReducer,
cart: cartReducer,
},
})
I would like to copy some data from the products slice into the cart slice when the user clicks an "Add to cart" button in the UI. This data will include the product ID and quantity which is currently set in the products slice. I'd like to dispatch an action that copies that data across, instead of having to pull the data out into a component and then pass it back in through the dispatched action. Is this possible with redux toolkit? Is this a use-case for a thunk?