File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -58,3 +58,25 @@ const isSecondMarkdownNote = note.type == 'markdown' && note.index == 2
58
58
const isNoteHasString = note .content .indexOf (' string' ) != - 1
59
59
if (isSecondMarkdownNote && isNoteHasString)
60
60
```
61
+
62
+ ### Use class property instead of class methods
63
+ When writing React components, try to use class property instead of class methods. The reason for this is explained perfectly here:
64
+ https://codeburst.io/use-class-properties-to-clean-up-your-classes-and-react-components-93185879f688
65
+
66
+ ** Example** :
67
+
68
+ ``` js
69
+ // BAD
70
+ class MyComponent extends React .Component {
71
+ myMethod () {
72
+ // code goes here...
73
+ }
74
+ }
75
+
76
+ // GOOD
77
+ class MyComponent extends React .Component {
78
+ myMethod = () => {
79
+ // code goes here...
80
+ }
81
+ }
82
+ ```
You can’t perform that action at this time.
0 commit comments