建议使用哪种方式使用 RTK 查询按顺序执行多个突变?
const [
updateProfile,
] = useUpdateProfileMutation();
const [
updatePost,
] = useUpdatePostMutation();
const performMutipleMuations = async () => {
const data= await updateProfile(newData);
await updatePost(data);
};
Run Code Online (Sandbox Code Playgroud)
最终使用unwrap成功了。
const performMutipleMuations = async () => {
const data= await updateProfile(newData).unwrap();
await updatePost(data).unwrap();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2620 次 |
| 最近记录: |