React-query :: api fetch ์‹œ ์‚ฌ์šฉํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
์›น (WEB)/๊ณต๋ถ€ 2021. 7. 10. 12:38

React-query : fetch, cache, synchronize, update(for server state)์— ์‚ฌ์šฉ๋˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ด๋‹ค. ๊ณต์‹์‚ฌ์ดํŠธ React Query Hooks for fetching, caching and updating asynchronous data in React react-query.tanstack.com ๋ฐฐ๊ฒฝ server state ์‚ฌ์šฉ ์‹œ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ์ ์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. caching deduping(๋ฐ์ดํ„ฐ ์ค‘๋ณต ์ œ๊ฑฐ) update "out of date" data / know when is it reflecting updates data pagination optimization, lazy loading data memory management, garba..

React-query :: Query Invalidation
์›น (WEB)/๊ณต๋ถ€ 2021. 7. 10. 12:37

query๊ฐ€ ์˜ค๋ž˜ ๋˜์—ˆ๋‹ค๋Š” ๊ฒƒ์„ ํŒ๋‹จํ•˜๊ณ  ๋‹ค์‹œ fetchํ•ด์˜ฌ ๋•Œ, queryClient.invalidateQueries ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. https://react-query.tanstack.com/guides/query-invalidation Query Invalidation Query Invalidation Waiting for queries to become stale before they are fetched again doesn't always work, especially when you know for a fact that a query's data is out of date because of something the user has done. For that purpose, the Quer..

React-query :: Mutations
์›น (WEB)/๊ณต๋ถ€ 2021. 7. 10. 12:36

query์™€ ๋‹ค๋ฅด๊ฒŒ CUD์— ์‚ฌ์šฉ๋œ๋‹ค. https://react-query.tanstack.com/guides/mutations Mutations Subscribe to our newsletter The latest TanStack news, articles, and resources, sent to your inbox. react-query.tanstack.com ์‚ฌ์šฉ์˜ˆ์ œ const mutation = useMutation(newTodo => axios.post('/todos', newTodo)) return ( {mutation.isLoading ? ( 'Adding todo...' ) : ( {mutation.isError ? ( An error occurred: {mutation.error.mes..

Ajax(Asynchronous Javascript And Xml)
์›น (WEB)/๊ณต๋ถ€ 2021. 2. 6. 23:04

Ajax๋Š” js๋ฅผ ์ด์šฉํ•œ ๋น„๋™๊ธฐ ํ†ต์‹ ์œผ๋กœ, ํด๋ผ์ด์–ธํŠธ ์„œ๋ฒ„ ๊ฐ„์˜ xml(Extensible Markup Language)๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ ๋ฐ›๋Š” ๊ธฐ์ˆ ์ด๋‹ค. ์ „์ฒด ํŽ˜์ด์ง€๋ฅผ ๋ฆฌ๋กœ๋“œํ•˜์ง€ ์•Š๊ณ  ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ๋งŒ ๋กœ๋“œํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ์žฅ์ ์ด ์žˆ๋‹ค. Ajax ๋ฐฉ์‹์„ ์ด์šฉํ•œ ์›น API๋Š” XMLHttpRequest ๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜์—ฌ fetch๋ฅผ ๊ฑฐ์ณ axios๊นŒ์ง€ ๋‹ค์–‘ํ•˜๋‹ค. XMLHttpRequest๋Š” ๋ณต์žกํ•˜๊ณ  ๊ฐ€๋…์„ฑ์ด ๋–จ์–ด์ง€๊ธฐ ๋•Œ๋ฌธ์— fetch api๊ฐ€ ES6์—์„œ๋ถ€ํ„ฐ ํ‘œ์ค€์ด ๋˜์—ˆ๋Š”๋ฐ, ๋”ฐ๋ผ์„œ ํ˜„์žฌ fetch api๋Š” ๊ธฐ๋ณธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋กœ ๋”ฐ๋กœ ์„ค์น˜ํ•˜์ง€ ์•Š๊ณ  ์‚ฌ์šฉํ•ด๋„ ๋œ๋‹ค. axios๋Š” Node.js์—์„œ XMLHttpRequests๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์ข‹๊ฒŒ ๋งŒ๋“ค์–ด๋‘” api์ด๋ฉฐ ๋”ฐ๋กœ ์„ค์น˜ํ•ด์ฃผ์–ด์•ผ ๋™์ž‘ํ•œ๋‹ค. TOP Ajax API๋ฅผ ์ฐธ๊ณ ํ•˜๋ฉด ๋” ๋งŽ์€..