should I use state with tRPC

Hi, this may be a dumb question, but I can't seem to find a proper answer on Google. I am creating a simple t3 app that stores values in a database and then displays them on a grid. I am using tRPC, using a useState to store the data, and modifying the state on mutation success for example. Is this how I am supposed to do it or is there a way to do it without the useState, using directly the tRPC data and refetching on mutation?
2 Replies
Neto
Neto2y ago
yea, is totally fine to do that
cje
cje2y ago
what do you mean by "using a useState to store the data" if you have a thing that gets a value from db, gives you an input to change the value, and a button to send the changed value back to db, then yea putting the input state in useState makes sense on mutation success you should probably just invalidate
Want results from more Discord servers?
Add your server