const leave, setLeave useState (false) Now, I don't know where and how to use this state for displaying the alert box before leaving. I am using a state leave, if it true then alert the user before moving out else nothing. This way you can easily validate forms, show messages and submit them when the input data is valid. I am using the react-hook-form for storing the data in the JSON server. Parameter values hold all values from form.
0 Comments
Leave a Reply. |