NewOldMax / react-form-validator-core

Core validator component for react forms
MIT License
94 stars 44 forks source link

Getting a warning on form submit #47

Closed iskrenantonov closed 5 years ago

iskrenantonov commented 5 years ago

I am using react-material-ui-form-validator (which depends on react-form-validator-core) in one of my projects and every form throws a warning when submitting like this:

Warning: This synthetic event is reused for performance reasons. If you're seeing this, you're accessing the method preventDefault on a released/nullified synthetic event. This is a no-op function. If you must keep the original synthetic event around, use event.persist(). See https://fb.me/react-event-pooling for more information.

This happens in ValidatorForm.jsx in the submit method.

react - v16.8.4 react-material-ui-form-validator - v2.0.7 react-form-validator-core - v0.6.2

NewOldMax commented 5 years ago

Hi, can you show your code?

iskrenantonov commented 5 years ago

<ValidatorForm id="form-login" onSubmit={ this.onSubmit } noValidate="novalidate"


onSubmit() { const { formData } = this.state;

    this.props.login({
        username: formData['username'],
        password: formData['password']
    });

} debugger_output

NewOldMax commented 5 years ago

Can you reproduce your issue on https://codesandbox.io ?

iskrenantonov commented 5 years ago

https://codesandbox.io/s/08jx447ln?fontsize=14 It seems the event is nulled before to be passed to my component's onSubmit method, so it's throwing warnings. I'll fix it on my side. Thank you very much :) PS I forgot to save the snippet, it's working now :)