Best practices
- pascalCase for component file name and folder name
- lowerCamelCase for Higher Order Component file and folder name
- lowercase for all other root directory folders. For example:
src
,components
,assets
Anti-pattern
- anti-pattern to copy properties that never change to the state (just access .props directly in that case)
Note: Using props to generate state in getInitialState often leads to duplication of “source of truth”, i.e. where the real data is.
Issues
- Deeply nested directories in JavaScript can cause many pain points, such as difficulty writing relative imports and updating those imports.
Structuring project recommends:
Articles: How I structure my React apps