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..
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..
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๋ js๋ฅผ ์ด์ฉํ ๋น๋๊ธฐ ํต์ ์ผ๋ก, ํด๋ผ์ด์ธํธ ์๋ฒ ๊ฐ์ xml(Extensible Markup Language)๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ๋ ๊ธฐ์ ์ด๋ค. ์ ์ฒด ํ์ด์ง๋ฅผ ๋ฆฌ๋ก๋ํ์ง ์๊ณ ํ์ํ ๋ฐ์ดํฐ๋ง ๋ก๋ํ ์ ์๋ค๋ ์ฅ์ ์ด ์๋ค. Ajax ๋ฐฉ์์ ์ด์ฉํ ์น API๋ XMLHttpRequest ๋ถํฐ ์์ํ์ฌ fetch๋ฅผ ๊ฑฐ์ณ axios๊น์ง ๋ค์ํ๋ค. XMLHttpRequest๋ ๋ณต์กํ๊ณ ๊ฐ๋ ์ฑ์ด ๋จ์ด์ง๊ธฐ ๋๋ฌธ์ fetch api๊ฐ ES6์์๋ถํฐ ํ์ค์ด ๋์๋๋ฐ, ๋ฐ๋ผ์ ํ์ฌ fetch api๋ ๊ธฐ๋ณธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ก ๋ฐ๋ก ์ค์นํ์ง ์๊ณ ์ฌ์ฉํด๋ ๋๋ค. axios๋ Node.js์์ XMLHttpRequests๋ฅผ ์ฌ์ฉํ๊ธฐ ์ข๊ฒ ๋ง๋ค์ด๋ api์ด๋ฉฐ ๋ฐ๋ก ์ค์นํด์ฃผ์ด์ผ ๋์ํ๋ค. TOP Ajax API๋ฅผ ์ฐธ๊ณ ํ๋ฉด ๋ ๋ง์..
Comment