diff --git a/src/Async.tsx b/src/Async.tsx index 3c35729..d7cc11a 100644 --- a/src/Async.tsx +++ b/src/Async.tsx @@ -1,4 +1,4 @@ -import React, {useMemo, useState} from "react"; +import React, {useEffect, useState} from "react"; /** * Asynchronous data state. @@ -59,7 +59,7 @@ export function useAsync(promise: Promise|PromiseFn, deps: any[] = []): }; // Reconfigure the promise when any deps have changed. - useMemo(() => { + useEffect(() => { (promise as Promise).then((result) => { // When there is a result, disable pending state and set retrieved data, without error. updateState({