Prevent some fast operation (eg. click)
npm install @rcp/c.preventfastop
# or use yarn
yarn add @rcp/c.preventfastop
import { PreventFastClick, PreventFastOperation } from '@rcp/c.preventfastop'
const App = () => {
return (
<div>
<PreventFastOperation
operationName={'onClick'}
onOperation={async () => {
await apiSubmit()
}}
>
<Button>提交</Button>
</PreventFastOperation>
{/* Same as */}
<PreventFastClick
onClick={async () => {
await apiSubmit()
}}
>
<Button>提交</Button>
</PreventFastClick>
</div>
)
}
This library is written and maintained by 余聪, yucong@yuanfudao.com.
MIT