dynamic query and mutation
Hello. I have an
this code is going to be repeated for different models (Product, User, Color, Category, etc.). so, I am looking for a way to make it DRY and reusable.
the only difference between them is the model name in trpc
how can I make it reusable? I thought maybe I can create a Component for it and pass
edit form component like this:this code is going to be repeated for different models (Product, User, Color, Category, etc.). so, I am looking for a way to make it DRY and reusable.
the only difference between them is the model name in trpc
trpc.admin.THE_MODEL_NAME and the validation schema. the rest are just same and repeatedhow can I make it reusable? I thought maybe I can create a Component for it and pass
fetchData, updateData props to handle the query and mutations. but they are harder to manage as I can't track the status and abort on unmount