0.0.1 • Published 3 years ago

useeffectasync v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

🌈 This is a simple abstraction though it makes the asyn/await code look good with useEffectAsync instead of implementing something like

With useEffectAsync you can simply use async function ⛄. I.e.,

import {useEffectAsync} from 'useeffectasync'

useEffectAsync(async () => {
	// await .. blah .. blah
	})

NOTE: You can definitely use dependencies array as second parameters as we generally use useEffect hook. That is super cool with useEffectAsync too.

Hmm, that was simple, but how does it look to use same example with bare useEffect ??

useEffect(() => {
	async function myAsyncAwaitSugargedCode() {
		// await .. blah .. blah
	}
	myAsyncAwaitSugargedCode()
	})

Yeah, that's a little weirder. 🌊

CAUTION: The cleanup functionality isn't possbile to use with useEffectAsync(I don't ever care about it though. ✨✨)

Thanks.

0.0.1

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago