Skip to content

Commit 3ace5f9

Browse files
committed
Add deprecation notice for undocumented useAsync(promiseFn, initialValue) shorthand.
1 parent 5e1ad23 commit 3ace5f9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/useAsync.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const useAsync = (opts, init) => {
77
const prevOptions = useRef(undefined)
88
const abortController = useRef({ abort: () => {} })
99

10+
if (typeof opts === "function" && init) {
11+
console.warn("`useAsync(promiseFn, initialValue)` is deprecated and will be removed soon.")
12+
}
1013
const options = typeof opts === "function" ? { promiseFn: opts, initialValue: init } : opts
1114
const { promiseFn, deferFn, initialValue, onResolve, onReject, watch, watchFn } = options
1215

0 commit comments

Comments
 (0)