You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Here is the usage of the useCreateMany hook:
import{useCreateMany}from"@refinedev/core";const{ mutate }=useCreateMany();mutate({resource: "products",mutationMode: "optimistic",successNotification: false,values: [{name: "Product 1",material: "Wood",},{name: "Product 2",material: "Metal",},],},{onSuccess: ()=>{/* do something after mutation success */},},);
In this use case, all parameters except the values are static. However, when I want to use the mutate function in different places, I have to rewrite these values, which can cause code duplication.
Describe the thing to improve
To improve developer experience, the useCreateMany() hook can directly pass all required values to the mutate function. This will reduce code duplication and improve readability.
New API:
import{useCreateMany}from"@refinedev/core";constDemo=()=>{const{ mutate }=useCreateMany({resource: "products",mutationMode: "optimistic",successNotification: false,values: [{name: "Product 1",material: "Wood",},{name: "Product 2",material: "Metal",},],mutationOptions: {onSuccess: ()=>{/* do something after mutation success */},},});consthandleUpdate=(values)=>{mutate(;};return/* Your JSX code here */;};
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Here is the usage of the
useCreateMany
hook:In this use case, all parameters except the
values
are static. However, when I want to use themutate
function in different places, I have to rewrite these values, which can cause code duplication.Describe the thing to improve
To improve developer experience, the
useCreateMany()
hook can directly pass all required values to themutate
function. This will reduce code duplication and improve readability.New API:
The text was updated successfully, but these errors were encountered: