We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
用于给一个异步函数增加竞态锁,防止并发执行,例如可以避免表单的重复提交。
function useLockFn<T>(fn: T): T
const submit = useLockFn(async () => { await api.doSubmit(...) message.success() }) return ( <button onClick={submit}>Submit</button> )
The text was updated successfully, but these errors were encountered:
能举一些使用场景的例子吗?
避免表单的重复提交,一般都是用 useRequest/useAsync,点击后 button 变 loading 态。 表单场景肯定不需要 useLockFn~~
还有其它场景吗?
Sorry, something went wrong.
+1
awmleer
Successfully merging a pull request may close this issue.
用于给一个异步函数增加竞态锁,防止并发执行,例如可以避免表单的重复提交。
API
Demo
The text was updated successfully, but these errors were encountered: