在我必须管理的组件容器中 两个域,帖子和用户喜欢:
const { data: posts, isError:isErrorPosts, isLoading: isLoadingPosts } = usePosts();
const createPostMutation = useCreatePost();
const handlerSubmitData = (data: PostDataDto) => {
createPostMutation.mutate(data);
};
const { data: users, isError:isErrorUsers, isLoading: isLoadingUsers } = useUsers();
const userFollowMutation = useUserFollow();
const userUnFollowMutation = useUserUnFollow();
const handlerUserStatus = (data: UserStatusDto) => {
if (data.status === UserStatus.FOLLOW) {
userFollowMutation.mutate(data.user);
} else {
userUnFollowMutation.mutate(data.user);
}
};
当我对用户和帖子触发突变时 得到更新。 有没有办法只更新用户域?