button - Reactjs form onSubmit not working -


i trying build dynamic div contains different components based on state. have custom components active, stable , form.

render: function () {   var components = [];   if (this.state.isactive) {      components.push(react.dom.active));   }    if (this.state.isstable) {      components.push(react.dom.stable({}));   }   if (this.state.visible) {     components.push(react.dom.form({}));   }   return react.dom.div({}, components); } 

the form component simple form has

handlesubmit(e) {   e.preventdefault();   console.log('submitted'); } render: function() {   return react.dom.form({onsubmit: this.handlesubmit}, [react.dom.button({},'submit')]); 

}

the handlesubmit method never invoked. if change code to:

render: function () {   var components = [];   components.push(react.dom.form({}));   return react.dom.div({}, components); } 

does know problem come from?

you need {onsubmit: this.handlesubmit} in react.dom.form call.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -