()
| 5 | |
| 6 | |
| 7 | export const MultipleCustomHooks = () => { |
| 8 | |
| 9 | const { counter, increment } = useCounter(1); |
| 10 | const { data, isLoading, hasError } = useFetch(`https://www.breakingbadapi.com/api/quotes/${ counter }`); |
| 11 | const { author, quote } = !!data && data[0]; |
| 12 | |
| 13 | return ( |
| 14 | <> |
| 15 | <h1>BreakingBad Quotes</h1> |
| 16 | <hr /> |
| 17 | |
| 18 | { |
| 19 | isLoading |
| 20 | ? <LoadingQuote /> |
| 21 | : <Quote author={ author } quote={ quote } /> |
| 22 | } |
| 23 | |
| 24 | <button |
| 25 | className="btn btn-primary" |
| 26 | disabled={ isLoading } |
| 27 | onClick={ () => increment() }> |
| 28 | Next quote |
| 29 | </button> |
| 30 | |
| 31 | </> |
| 32 | ) |
| 33 | } |
nothing calls this directly
no test coverage detected