Answer the question
In order to leave comments, you need to log in
How to pass asynchronous parameters to action (redux, thunk)?
I have a problem when passing data to action. I have an actions.js file that has a setCart(value) function that accepts a value as input.
export const setCart = (value) => ({type: ADD_TO_CART, payload: value});
const App = ({setCart}) => {
const fetchCart = async () => {
const res = await commerce.cart.retrieve()
setCart(res);
};
}
const mapDispatchToProps = {
setCart
}
export default connect(null, mapDispatchToProps)(App);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question