benawad / benawad/react-hooks-examples

Async not allowed inside useEffect()

Open
#4 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
85
Forks
50
PR merge metrics
No merged PRs in 30d

Description

Great video and clean approach. However, it seems that in the React 16.8 this way of using async is not allowed. The console throws this error:

> Warning: An Effect function must not return anything besides a function, which is used for clean-up. It looks like you wrote useEffect(async () => ...) or returned a Promise.

Any chance you can refactor to comply?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.