You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our React style is mostly influenced by [David Chang's style guide](https://reactjsnews.com/react-style-guide-patterns-i-like/). Exceptions are enumerated below.
1454
+
1455
+
- Since `displayName` is automatically set by React after calling `React.createClass()` and transpiling from JSX to JavaScript, there's no need to explicitly include one:
1456
+
1457
+
```javascript
1458
+
// Preferred
1459
+
React.createClass({
1460
+
propTypes: {},
1461
+
mixins: [],
1462
+
getInitialState:function () {},
1463
+
componentWillMount:function () {},
1464
+
componentWillUnmount:function () {},
1465
+
render:function() {}
1466
+
});
1467
+
1468
+
// Not preferred
1469
+
React.createClass({
1470
+
displayName:'',
1471
+
propTypes: {},
1472
+
mixins: [],
1473
+
getInitialState:function () {},
1474
+
componentWillMount:function () {},
1475
+
componentWillUnmount:function () {},
1476
+
render:function () {}
1477
+
});
1478
+
```
1479
+
1480
+
- When it comes to conditionals, we tend to prefer `&&` to ternaries and will often use `&&` rather than breaking logic out into separate methods:
0 commit comments