()
| 25 | } |
| 26 | |
| 27 | function Example() { |
| 28 | const { isPending, error, data, isFetching } = useQuery(reposQueries.detail()) |
| 29 | |
| 30 | if (isPending) return 'Loading...' |
| 31 | |
| 32 | if (error) return 'An error has occurred: ' + error.message |
| 33 | |
| 34 | return ( |
| 35 | <div |
| 36 | style={{ |
| 37 | paddingBottom: 20, |
| 38 | }} |
| 39 | > |
| 40 | <h1>{data.full_name}</h1> |
| 41 | <p>{data.description}</p> |
| 42 | <strong>👀 {data.subscribers_count}</strong>{' '} |
| 43 | <strong>✨ {data.stargazers_count}</strong>{' '} |
| 44 | <strong>🍴 {data.forks_count}</strong> |
| 45 | <div>{isFetching ? 'Updating...' : ''}</div> |
| 46 | </div> |
| 47 | ) |
| 48 | } |
| 49 | |
| 50 | const rootElement = document.getElementById('root') |
| 51 | if (!rootElement) throw new Error('Missing #root element') |
nothing calls this directly
no test coverage detected