This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useCallback } from 'react' | |
| import { useAsync as useAsyncOne } from './useAsyncOne' | |
| import { useAsync as useAsyncTwo } from './useAsyncTwo' | |
| export const AppOne = ({ id = 'zork' }) => { | |
| const { fetcher, cancel } = useCallback(() => apiCall(id), [ id ]) | |
| // Signature is: (asyncFn, cancellation, call immediately?) | |
| const { asyncState, data, error, exec } = useAsyncOne(fetcher, cancel, true) |