React - Preventing Form Submission

前端 未结 11 881
一个人的身影
一个人的身影 2020-11-27 06:35

I\'ve been experimenting with React. In my experiement, I\'m using the Reactstrap framework.When I click a button, I\'ve noticed that the HTML form submits. Is there a way t

11条回答
  •  一向
    一向 (楼主)
    2020-11-27 07:12

    You have prevent the default action of the event and return false from the function.

    function onTestClick(e) {
        e.preventDefault();
        return false;
    }
    

提交回复
热议问题