How can I find out when an Redux action is done

Viewed 2610

I'm googling and I haven't really found anything, or I just don't understand it. I have Redux Thunk and I'm going through their examples but I'm not sure if that will help me?

I normally would use a Promise.. but from what I understand when Redux updates the state, it is done Asyncronously.. so I don't think that would work?

export function setComposition( composition ) {  
  return { type: types.SET_COMPOSITION, composition };
}

export function doStuff() {
  // What I'd like to do:
  dispatch(setComposition).then(() => {
    console.log('done');
  });
}

EDIT:

This is what I was thinking of doing... but i dont think will work because doesn't the state get updated asynchronously?

export function setComposition( composition ) {  
  return Promise.resolve(
    return { type: types.SET_COMPOSITION, composition };
  );
}
2 Answers
Related