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: 6/6/2023, 4:05:10 AM
Contributors: John