mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-26 23:14:19 +00:00
18 lines
374 B
JavaScript
18 lines
374 B
JavaScript
|
/* eslint-disable */
|
||
|
import { useEffect } from "react"
|
||
|
|
||
|
|
||
|
/**
|
||
|
* {@link useEffect}, but with an async effect.
|
||
|
*
|
||
|
* @warning Breaks `react-hooks/exaustive-deps`.
|
||
|
*
|
||
|
* @param effect - The async effect.
|
||
|
* @param deps - The dependencies of the hook.
|
||
|
*/
|
||
|
export default function useAsyncEffect(effect, deps) {
|
||
|
useEffect(() => {
|
||
|
effect()
|
||
|
}, [effect, ...deps])
|
||
|
}
|