use-react-hooks icon indicating copy to clipboard operation
use-react-hooks copied to clipboard

useEffect should run asynchronously

Open RoystonS opened this issue 6 years ago • 1 comments

Hi there - nice-looking work so far! One little thing I noticed: I think useEffect is meant to schedule the effect to run asynchronously, after rendering has completed (e.g. via requestAnimationFrame). useLayoutEffect and useMutationEffect run closer to the original render() function timing, but useEffect runs later.

(A quick trial with real React 16.7 alpha shows that work scheduled with useEffect runs after work scheduled with requestAnimationFrame, and definitely way after rendering.)

RoystonS avatar Nov 07 '18 23:11 RoystonS

Would love to see a PR to fix this then :)

tannerlinsley avatar Nov 07 '18 23:11 tannerlinsley