Skip to content

Commit

Permalink
Fix S6790: Use method definition in code snippets (#3420)
Browse files Browse the repository at this point in the history
  • Loading branch information
vdiez authored Nov 7, 2023
1 parent c79e30a commit 45cb94c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rules/S6790/javascript/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Older React versions allowed the ref attribute to be a string, like `"textInput"
[source,javascript,diff-id=1,diff-type=noncompliant]
----
const Hello = createReactClass({
componentDidMount: function() {
componentDidMount() {
const component = this.refs.hello; // Noncompliant
// ...
},
render: function() {
render() {
return <div ref="hello">Hello, world.</div>;
}
});
Expand All @@ -26,7 +26,7 @@ Instead, reference callbacks should be used. These do not have the limitations m
[source,javascript,diff-id=1,diff-type=compliant]
----
const Hello = createReactClass({
componentDidMount: function() {
componentDidMount() {
const component = this.hello;
// ...
},
Expand Down

0 comments on commit 45cb94c

Please sign in to comment.