State syncing with local state - is there a better way?
So I was reading this article from TkDodo where he basically says that state syncing is to be avoided if at all possible https://tkdodo.eu/blog/breaking-react-querys-api-on-purpose . So I'm wondering the best way to handle this situation.
I have a useQuery that gets a list of quotes that each have a quote ID. The quotes are displayed in a table with a checkbox next to each quote. Now I have a local state for
Here is my useQuery and state:
Is a better option to add a
I have a useQuery that gets a list of quotes that each have a quote ID. The quotes are displayed in a table with a checkbox next to each quote. Now I have a local state for
checkedQuoteIDs to keep track of which ones are checked. I want them all to be checked by default to begin with.Here is my useQuery and state:
Is a better option to add a
select into that useQuery and add a checkedQuotes array to the quoteList object? Or should I be using my local state variable to keep track of checked quotes? How do I initially set them all as checked then?Why good API design matters, even if it means breaking existing APIs in the face of resistance.
