Hello,
On the react course, on the react components section, project Authorization From (link: https://www.codecademy.com/courses/react-101/projects/authorization-form)
We have a method in the project that is called from the onSubmit event of the form. When we call that method, we don’t pass any parameters to it. Yet, something is passed because the function knows what “e” is. I’m curious to what is this mechanism at play? What is it called and how does it work? Does Javascript always passes something on to functions when we call them? I’m confused by this.
authorize(e) {
const password = e.target.querySelector(
‘input[type=“password”]’).value;
const auth = password == this.state.password;
this.setState({
authorized: auth
});
}
Thank you for your help.