'What is the recommended way to perform multiple mutations in sequence in RTK Query?

Which way is recommended to perform multiple mutations in sequence using RTK Query?

  const [
    updateProfile, 
  ] = useUpdateProfileMutation();

  const [
    updatePost,
  ] = useUpdatePostMutation();


  const performMutipleMuations = async () => {
    const data= await updateProfile(newData);
    await updatePost(data);
  };





Solution 1:[1]

Ultimately using unwrap made the trick.

  const performMutipleMuations = async () => {
    const data= await updateProfile(newData).unwrap();
    await updatePost(data).unwrap();
  }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dan_boy