관리 메뉴

Silver Library (Archived)

react-query 와 RTK query 에 대한 생각. 본문

Face the fear, build the future

react-query 와 RTK query 에 대한 생각.

Chesed Kim 2022. 12. 24. 23:26
반응형

요약을 하자면:

"eliminating the need to hand-write data fetching & caching logic yourself." - RTK query

'Powerful asynchronous state management' - react-query

 

사실 react-query 를 써보기는 했으나, Redux 를 막상 지금 써보니 Redux 도 괜찮다는 생각이 든다.

그리고 노린 듯이...이 RTK query 를 끼워서 제공한다고 한다.

 

다만 이전에 react-query 로 하면서 CORS policy 에러가 문득문득 되었다 안되었다 하는 현상을 본 적이 있으므로(다만 이버전은 tanstack 이 아닌, 기존 버전이었으니 이해는 간다. 덕분에 그 에러를 피하려면 어찌해야 하는지도 알게 되었으니...) 개인적으로는 RTK query 도 한번 접해보고 싶다는 욕구가 강해지고 있는 요즘이다.

 

어느 쪽이든, 머리로 이해하고만 있어야 한 상태관리 설계를 직관적이게 볼 수 있도록 도와주고 있으니 말이다.

 

React-query 주장:

https://tanstack.com/query/v4/docs/react/comparison?from=reactQueryV3&original=https%3A%2F%2Freact-query-v3.tanstack.com%2Fcomparison 

 

Comparison | React Query vs SWR vs Apollo vs RTK Query vs React Router | TanStack Query Docs

This comparison table strives to be as accurate and as unbiased as possible. If you use any of these libraries and feel the information could be improved, feel free to suggest changes (with notes or evidence of claims) using the "Edit this page on Github"

tanstack.com

Redux (RTK query) 주장:

https://redux-toolkit.js.org/rtk-query/comparison#comparing-feature-sets

 

Comparison with Other Tools | Redux Toolkit

RTK Query > Comparison: Compares features and tradeoffs vs other similar tools

redux-toolkit.js.org