Skip to content

Commit 770cb59

Browse files
authored
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.
1 parent a2813dc commit 770cb59

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/docs/error-boundaries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class MyComponent extends React.Component {
152152
if (this.state.error) {
153153
return <h1>Caught an error.</h1>
154154
}
155-
return <div onClick={this.handleClick}>Click Me</div>
155+
return <button onClick={this.handleClick}>Click Me</button>
156156
}
157157
}
158158
```

0 commit comments

Comments
 (0)