Sign in
Log inSign up

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:

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct