blob: edcea020cc8b59e911dc112f385bed74fc39bca8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import { useQuery } from 'react-query'
import blogsApi from '../api/blogsApi'
const useBlogs = ({ limit, offset }) => {
const fetchBlogs = async () => await blogsApi({ limit, offset })
const blogs = useQuery(`blogs-${limit}-${offset}`, fetchBlogs, {
refetchOnWindowFocus: false
})
return { blogs }
}
export default useBlogs
|