agustinusnathaniel.com

React Function Component Definition Rule

How to enforce consistent function type for function components.

58 views

Example to force using arrow function when defining named components

js
// .eslintrc.js
{
  ...,
  "rules": {
    ...,
    "react/function-component-definition": [2, {
      "namedComponents": ["arrow-function"],
    }]
  }
}

References: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md


BaseBookmarksT.I.L.TemplatesTimelineAnalytics

© 2024 Agustinus Nathaniel