React Query
React application์์ ์๋ฒ ์ํ์ fetching, caching, synchronizing and updating์ ๋์์ฃผ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ
import {
useQuery,
useMutation,
useQueryClient,
QueryClient,
QueryClientProvider,
} from 'react-query'
import { getTodos, postTodo } from '../my-api'
// Create a client
const queryClient = new QueryClient()
function App() {
return (
// Provide the client to your App
<QueryClientProvider client={queryClient}>
<Todos />
</QueryClientProvider>
)
}fetcherํจ์์argument๊ฐ ํ์ํ ๊ฒฝ์ฐ ์ต๋ช ํจ์๋ฅผ ๋ง๋ค์ดfetcherํจ์๋ฅผ ๋ฆฌํดํจkey๋ ์บ์ ์์คํ ์ ์ ์ฅ๋๊ณ ์๋ํ๊ธฐ ์ํด ๊ณ ์ ํ ๊ฐ์ด์ด์ผ ํจ
React Query Devtools
React Query์ ๋ชจ๋ ๋ด๋ถ ์๋์ ์๊ฐํ ํ์ฌ ๋ณด์ฌ์ค
์บ์์ ์ด๋ค query๊ฐ ์๋์ง์ Data Explorer ์ ๊ณต
Import the Devtools
Floating Mode
Last updated