DevTools/CodingStandards: Difference between revisions

No edit summary
Line 154: Line 154:
=== Components ===
=== Components ===
* Default to creating components as [https://facebook.github.io/react/docs/reusable-components.html#stateless-functions stateless function components].  
* Default to creating components as [https://facebook.github.io/react/docs/reusable-components.html#stateless-functions stateless function components].  
* If you need local state, lifecycle methods, or to access the DOM node, you’ll need to use a class-based component instead.
* If you need local state or lifecycle methods, use `React.createClass` instead of functions.
* Use React.DOM to create native elements. Assign it to a variable named `dom`, and use it like `dom.div({}, dom.span({}))`. You may also destructure specific elements directly: `const { div, ul } = React.DOM`.
 


=== PropTypes ===
=== PropTypes ===
Confirmed users
508

edits