My FeedDiscussionsHeadless CMS
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

How do you structure your ReactJS component definitions?

Deactivated User's photo
Deactivated User
·Jun 20, 2016
  • How do you order methods inside Component class definition? Some methods must be "implemented", others are your own, custom methods. How do you maximize readability?
  • Do you name your handler in a specific way? handleSomething, somethingHandler, onSomeEvent. For example, to distinguish which handlers are attach to child components (e.g. list elements) and which are used by the component itself (for it's own markup).
  • What other rules do you follow when writing components?
  • Do you use ES6 or ES7 features?

Edit: found out that yannickcr/eslint-plugin-react and airbnb/javascript have some of the answer: