Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1import React from 'react'; 2import { Client, Provider, fetchExchange } from 'urql'; 3 4import { cacheExchange } from '@urql/exchange-graphcache'; 5 6import Songs from './Songs'; 7 8const cache = cacheExchange({ 9 keys: { 10 Alphabet: data => data.char, 11 Song: () => null, 12 }, 13}); 14 15const client = new Client({ 16 url: 'http://localhost:3004/graphql', 17 exchanges: [cache, fetchExchange], 18}); 19 20function App() { 21 return ( 22 <Provider value={client}> 23 <Songs /> 24 </Provider> 25 ); 26} 27 28export default App;