()
| 122 | </div> |
| 123 | ) |
| 124 | } |
| 125 | function usePosts() { |
| 126 | return useQuery({ |
| 127 | queryKey: ['posts'], |
| 128 | queryFn: async (): Promise<Array<Post>> => { |
| 129 | const response = await fetch('https://jsonplaceholder.typicode.com/posts') |
| 130 | return await response.json() |
| 131 | }, |
| 132 | }) |
| 133 | } |
| 134 | |
| 135 | const Context = createContext<{ |