Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
A button inside a form is of type submit by default, and it is the form's event that fires accordingly. The easiest way is to add an onSubmit handler to the form element.
Another option is to add type='button' to the button element. But it seems that disabling disabled on a DOM element does not turn on the component, you need to call render again, and therefore you will have to redo the checkbox logic to connect it to the button through the state of the component, like <button disabled={this.state.checkrule}>
In the case of type='button', there is no need for preventDefault at all, the default action is not will.
In general, preventDefault doesn't fire because onClick doesn't fire. It works with getting disabled from state .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question