Open Vvtu opened 5 years ago
Is this <Button />
inside a <form>
tag? The default button type is "submit", so clicking on it will try to submit the form it is inside.
If this is it, then it's standard browser behaviour and not an issue with the library, and you can fix this easily by providing the type="button"
prop.
If this isn't the problem, please can you provide a codesandbox example of the issue?
<Button />
component. It is from custom special library that I have to use . If I replace it with simple <buttom />
html tag than everything is ok. There is no strange behavior in this case.So, thank you. Now no problem exists. I will use preventDefault to fix this case.
bug report
What is the current behavior?
form.reset() causes additional unpredictable effects and errors (bug report)
What's your environment?
Windows-7 Chrome-66 react-final-from@4.0.2 final-from@4.11.0 final-from-focus@1.1.0
Fixed by preventDefault()
Hear the code of reset button with preventDefault function: <Button onClick={(e) => { form.reset(e); e.preventDefault(); }} disabled={pristine || submitting}> {'Reset'}