You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After a form is submitted with an action, if one of the form's fields is a checkbox or radio input controlled by its checked prop, that element is reset as if it were uncontrolled. The same happens when the reset() method is called on the form. (Expected behavior: those fields are not reset.)
import{useState}from"react"exportdefaultfunctionPage(){const[isChecked,setIsChecked]=useState(false);return(<formaction={()=>{console.log("hello world!");}}><label>
Some checkbox
<inputtype="checkbox"checked={isChecked}onChange={(e)=>{setIsChecked(e.target.checked);}}/></label><button>Submit form</button></form>);}