I started my current project using SWR and then switched to react-query after dealing with some annoyances with SWR.
Overall react-query is impressive for data fetching, but I’ve run into issues with mutations and cache invalidation.
I've been disappointed at how SWR and react-query seem to only support the bare minimum for mutations. As far as I can tell, they don't offer any kind of protection from refreshes overwriting any local mutations that haven't been saved to the server yet. They don't do any handling around updating the data on the server, so you need to handle issues yourself like retrying, deciding when to send to the server, and making sure you never have overlapping update requests racing each other. I've had trouble finding any library in the React or general JS ecosystem that handles this stuff.
Hey! SWR author here. Mind sharing the annoyances and how I can make it better for you?
Thanks for your contribution and outreach! SWR has been really helpful for us at work.
I've used swr, but they seem very similar. Very easy to use for server synced state imho. Try both and pick the one that feels nicer to you.