Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use useFetch hook in tasks page #65

Merged
merged 2 commits into from Feb 4, 2021
Merged

Conversation

whyDontI
Copy link
Contributor

Closes #64

  • Refactored useFetch
  • Used useFetch in tasks page

sumitd94
sumitd94 previously approved these changes Jan 29, 2021
Copy link
Contributor

@sumitd94 sumitd94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

const [error, setError] = React.useState(null);
const [isLoading, setIsLoading] = React.useState(false);
React.useEffect(() => {
const useFetch = (url: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a reusable utility, I think a way to provide options would be good to have. So it can be used for any type of usecase.

setIsLoading(false);
} catch (err) {
setIsLoading(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally block will run regardless of the error not. So this is not needed here.

@whyDontI whyDontI merged commit faad9df into develop Feb 4, 2021
@whyDontI whyDontI deleted the feature/tasks-api-integration branch April 11, 2021 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use useFetch hook in tasks page
3 participants