DEV Community

Discussion on: Cleaner data fetching with react-query

kein1945 profile image

It’s similar to redux + normalizr libraries. But in case with normalizr we have more more powerful control of data.
What do you think about this approach?

caedes profile image
Romain Laurent

You will undoubtedly write much less code with react-query.

siddharthvenkatesh profile image
Siddharth Venkatesh Author

From what I've seen of normalizr, it helps you frame your backend response into something that is easier to render in your UI. react-query mainly focuses on how you fetch your data. Its also intelligent in terms of caching and refetching.
If you do want to use normalizr with react-query, you can apply the normalize function in the onSuccess handler of useQuery.