[x] I have ran the linting and formatting scripts to make sure the code is consistently styled.
[x] I have built/compiled and ran the tests to make sure the code works correctly.
[x] I have added or changed tests to cover new or different functionality, where applicable.
[x] Create an issue and link to the pull request.
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Description
Extract out error/response logic from the component to a reusable hook to avoid complicated state in the component.
Use a context to provide metric details for the request to avoid prop drilling.
Create a reusable component to reuse logic for switching between a graph, loading bar or error.
Issue
This PR addresses issue #71.
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.