Mutation

If you need to modify the data returned by the request, you can use mutate() to modify the data directly.

By the way, the example above is just a simple illustration. If you only need to make simple modifications to data in real business scenarios, it is recommended to use computed.

const { data } = useRequest(getUser);
const slogan = computed(() => `Welcome, ${data.value}!`);
Last Updated: 7/6/2023, 3:23:08 AM
Contributors: John