diff --git a/react/README.md b/react/README.md index e7679d26da..a075627265 100644 --- a/react/README.md +++ b/react/README.md @@ -29,6 +29,9 @@ This style guide is mostly based on the standards that are currently prevalent i - Always use JSX syntax. - Do not use `React.createElement` unless you’re initializing the app from a file that is not JSX. - [`react/forbid-prop-types`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md) will allow `arrays` and `objects` only if it is explicitly noted what `array` and `object` contains, using `arrayOf`, `objectOf`, or `shape`. + - Consider not using React memo,useMemo and useCallback hooks in the code unless there is no way to write the code. + - React specific file names should start with Capital letter where as Javascript specific file name can start with small letter. + - Try to write folder specific components,so its easy to navigate. ## Class vs `React.createClass` vs stateless @@ -52,6 +55,21 @@ This style guide is mostly based on the standards that are currently prevalent i } ``` + ```filenames in React + // bad + header.jsx + + //good + Header.jsx + + + ```filenames in Javascript + //bad + Header.js + + //good + header.js + And if you don’t have state or refs, prefer normal functions (not arrow functions) over classes: ```jsx