localvoid / ivi

Lighweight Embeddable Web UI Library
MIT License
724 stars 22 forks source link

useEffect cannot accept an async function #62

Closed leeoniya closed 1 year ago

leeoniya commented 1 year ago

@localvoid

i have to pass it a regular function containing an async iife wrapper if i want to use await loops inside.

(probably same applies to IdleEffect and LayoutEffect)

localvoid commented 1 year ago

useEffect() hook in React also doesn't work with async functions. https://devtrium.com/posts/async-functions-useeffect

leeoniya commented 1 year ago

ok, that explanation makes sense :+1: