When you need to modify the requested data. You can use mutate() to directly modify data

By the way, the above example is just a simple example. In real business, if you just make some simple modifications to data, and do not need to use Cache and Preload, we recommended to use computed.

const { data } = useRequest('api/user');
const slogan = computed(() => `Welcome, ${data.value}!`);
Last Updated: 6/29/2022, 7:38:54 AM
Contributors: John