import React from 'react'; import { useRequest } from 'react-rest-request'; import { Link } from 'react-router-dom'; import { DelayEndpoint } from './endpoint'; export function MainPage() { return Move to delay page } export function DelayPage() { const { data, loading, cancel, isCanceled } = useRequest( DelayEndpoint, { params: { seconds: 10, } } ); return (
Back to main page
{!data ? (
{ loading ? 'Loading...' : isCanceled ? 'Request was canceled' : 'Something went wrong' }
) :
Success
}
) }