React - Preventing Form Submission

前端 未结 11 871
一个人的身影
一个人的身影 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:10

    In your onTestClick function, pass in the event argument and call preventDefault() on it.

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

提交回复
热议问题