Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time

Enforce event handler naming conventions in JSX (react/jsx-handler-names)

Ensures that any component or prop methods used to handle events are correctly prefixed.

Rule Details

The following patterns are considered warnings:

<MyComponent handleChange={this.handleChange} />
<MyComponent onChange={this.componentChanged} />

The following patterns are not considered warnings:

<MyComponent onChange={this.handleChange} />
<MyComponent onChange={this.props.onFoo} />

Rule Options

"react/jsx-handler-names": [<enabled>, {
  "eventHandlerPrefix": <eventHandlerPrefix>,
  "eventHandlerPropPrefix": <eventHandlerPropPrefix>
  • eventHandlerPrefix: Prefix for component methods used as event handlers. Defaults to handle
  • eventHandlerPropPrefix: Prefix for props that are used as event handlers. Defaults to on

When Not To Use It

If you are not using JSX, or if you don't want to enforce specific naming conventions for event handlers.