Mutation

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: 2/11/2022, 8:31:25 AM
Contributors: John