After some years of software development, here is a personal list of best practices:
- Have a good naming convention
- Do not use index.js (see: https://www.youtube.com/watch?v=M3BM9TB-8yA)
- Have a module/component oriented file structure: I want to be able to remove a component directory from my project without breaking things.
- Use a (webpack) resolver to map /src as a root folder so I can just
import Component from 'components/Component'
(I hate../
) - Git, eslint, Jest, CircleCI are awesome + use Husky npm package
- Don’t try to make the perfect component from design, make it simple and let it evolve
- Avoid npm libraries, hardcode things when possible
- Avoid imports, write isolated functions
- Use functional components (React v16.8)
What do you think? What would you add?
Read more: https://medium.com/@almaju.fr/9-best-practices-i-learned-from-react-and-node-dfffd825a64a