Skip to contentOpen History to see the last commit
usePosts.js
13 lines285 Bytes
1import { useQuery } from "react-query"; 2import axios from "axios"; 4const getPosts = async () => { 5 const { data } = await axios.get( 6 "https://jsonplaceholder.typicode.com/posts" 11export default function usePosts() { 12 return useQuery("posts", getPosts);