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