DEV Community

Discussion on: Cleaner data fetching with react-query

Collapse
 
kein1945 profile image
Kein

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?

Collapse
 
siddharthvenkatesh profile image
Siddharth Venkatesh

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.

Collapse
 
caedes profile image
Romain Laurent

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