Set the endDate to an empty string, after it was changed to an endDate that is smaller than the startDate doesn't work, because it renders two times #742
-
Hello there, we added a handler function to our code (handleEndDateValue), that should do the following:
We observed, that (after changing the endDate to a smaller date than the startDate), the render process runs twice, therefore the alert runs twice as well and then the endDate will be set to an empty string. We don't know how to bypass this behavior, we tried to build in an useEffect, didn't work (deleted the useEffect form the code already), maybe you have an idea and can help us? This is the PR Here is the code, you will find it in pages/forms/TripForm/[id].js.
Looking forward to your feedback! Thanks in advance ✌️ 🐸 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @ahohnsen & @JessicaLoers, first of all, thank you for your input and the feedback! 🐸 We added the handler function + the state for the end date value to the onSubmit function, set the value of the End Date to endDateValue from the state and now everything works ✌️ Here is the code:
|
Beta Was this translation helpful? Give feedback.
Hi @ahohnsen & @JessicaLoers, first of all, thank you for your input and the feedback! 🐸
We added the handler function + the state for the end date value to the onSubmit function, set the value of the End Date to endDateValue from the state and now everything works ✌️
Here is the code: