reactjs - onSubmit event is not fired in React.js form -


my react based app contains form , somewhere along way stopped working, onsubmit no longer fired , form submitted new http request. while trying isolate problem stripped whole app following snippet (which jsfiddle taken question):

import react 'react'  var onsubmittest = react.createclass({     render: function () {         var dosomething = function () {             alert('it works!');         }          return <form onsubmit={dosomething}>             <button>click me</button>         </form>;     } });  react.render(<onsubmittest/>, document.body); 

the script on jsfiddle works should: message alerted before form submitted. no alert in app, though. if add e.preventdefault() jsfiddle form not submitted @ all, form is.

the difference build app using webpack , babel es6 it's hard believe have impact on matter.

any idea might reason? should try next debug that?

update: jsfiddle showing problem. linked file webpack output (not uglified in way keep readable, that's why it's huge). can find code (compiled) starting on line 53.

mystery solved: forgot mark node_modules directory excluded (i use intellij idea) when used refactoring change variable name form else, ide eagerly refactored whole react , replaced occurrences of form new value.

i fixed reinstalling npm dependencies.


Comments