In our project, we currently have the following tslint rule: jsx-no-lambda
When I need to capture event
from onSubmit,
My code looks similar to this:
public handleLogin = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
}
public render() {
return(
<form onSubmit={(event) => this.handleLogin(event)}>
...
}
This can be solved by removing the arrow function in the jsx like this:
<form onSubmit={ this.handleLogin }
Is there a more elegant solution to readability here? More specifically, letting the reader know where event
is coming from in this line: <form onSubmit={ this.handleLogin }
Additionally, how would one pass additional parameters to handleLogin
?