React-event word

is the ‘event’ word a JSX or JS keyword or just an example of a user defined ‘props’ word?

  **Your code so far**

class ControlledInput extends React.Component {
constructor(props) {
  this.state = {
    input: ''
// *******************
render() {
  return (
<input value={this.state.input} onChange={this.handleChange} />
      <h4>Controlled Input:</h4>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Challenge: Create a Controlled Input

Link to the challenge:

maybe it is just different to using props and relevant to the use of onChange as being an event handler function. maybe it sends a specialized object in using the event word.

No, it is not a key/reserved word (a list of those is here).

The event handler is a function. You can call the argument you pass as the event parameter anything you want (as long as it isn’t a key/reserved word), same as any variable.

But calling it event or e is sensible because that’s what it is, it represents an instance of the Event object. Calling it anything else (particularly, in this case, props) is likely to be extremely confusing.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.