My Register component:
const Register = () => {
const [name, setName] = useState('');
const onNameChange = (e) => {
setName(name = e.target.value);
};
<form className="form" onSubmit={onFormSubmit}>
<div className="form-group">
<input
type="text"
placeholder="Name"
name="name"
value={name}
onChange={onNameChange}
required
/>
</div>
</form>
My question is what is the purpose of putting the value attribute i.e "value={name}"?
I noticed that even without writing it(the value attribute), the value(e.target.value) is taken as whatever is over the said <input>. It seems to me that it functions the same without the value attribute.