ReactJs: Prevent multiple times button press

前端 未结 9 985
别跟我提以往
别跟我提以往 2020-11-27 13:21

In my React component I have a button meant to send some data over AJAX when clicked. I need to happen only the first time, i.e. to disable the button after it\'s first use.

9条回答
  •  情书的邮戳
    2020-11-27 13:45

    If you want, just prevent to submit.

    How about using lodash.js debounce

    Grouping a sudden burst of events (like keystrokes) into a single one.

    https://lodash.com/docs/4.17.11#debounce

    
    

提交回复
热议问题