Browse Source

Use semantic button for event handler example (#2781)

As a general rule, `onClick` handlers should not be applied to non-interactive elements like a `div`. There is not substantive change to the code sample, but it doesn't provide a better example of semantic HTML for developers reading the documentation.
main
Sean McPherson 5 years ago
committed by GitHub
parent
commit
770cb59d6c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      content/docs/error-boundaries.md

2
content/docs/error-boundaries.md

@ -152,7 +152,7 @@ class MyComponent extends React.Component {
if (this.state.error) {
return <h1>Caught an error.</h1>
}
return <div onClick={this.handleClick}>Click Me</div>
return <button onClick={this.handleClick}>Click Me</button>
}
}
```

Loading…
Cancel
Save