ERROR: Invalid assignment target when using a type in ref
form?.name. I assume you had it there because originally you had a possibly undefined form.name. After initializing your ref, I removed the question mark in my reproduction because form.name always exists.