CONTACT US

15 React Best Practices You Need to Follow in 2020

  • ๐Ÿ› Keep components small and function-specific
  • โ™ป๏ธ Reusability is important, so keep creation of new components to the minimum required
  • ๐Ÿค Consolidate duplicate code โ€“ DRY your code
  • ๐ŸŽจ Put CSS in JavaScript
  • ๐Ÿ“ Comment only where necessary
  • ๐Ÿ“› Name the component after the function
  • ๐Ÿฆ’ Use capitals for component names
  • ๐Ÿซ Mind the other naming conventions
  • ๐ŸŽญ Separate stateful aspects from rendering
  • ๐Ÿš€ Code should execute as expected and be testable
  • ๐Ÿ“ All files related to any one component should be in a single folder
  • ๐Ÿงฐ Use tools like Bit
  • ๐Ÿ“š Use snippet libraries
  • โœ๏ธ Write tests for all code
  • ๐Ÿ”— Follow linting rules, break up lines that are too long

 

Article link copied

Close button