I'm building very simple forms with multiple submit buttons in React.
function SomeForm() {
const onSubmit = (e: FormEvent) => {
e.preventDefault();
console.log("submitted form button name is", e.nativeEvent?.submitter.name);
}
return (
<form onSubmit={onSubmit}>
<input type="text" name="someInput" />
<button type="submit" name="btn1">Btn1</button>
<button type="submit" name="btn2">Btn2</button>
</form>
);
}
Will form event's nativeEvent.submitter.name work consistently across all browsers?