React Worst Practices — The Conclusion

Certainly, I can’t draw shapes without CSS.

1. Importing unwanted modules

2. Being Lazy when working with HTTP Requests

4. Not harnessing the power of hooks

Creating custom hook
With Hooks — Demo

4. Not following any directory structure

5. Not breaking a large component into smaller one

6. Spaghetti code in reusable components

7. Not doing prop type validation checks

8. Not using Error Boundaries

9. Not doing code splitting

10. Not following proper component naming convention

  1. Component Names should start with caps. No dashes and no underscope. Separate words by another Capital Letter.
  2. create a folder, the name of this folder will be in lower letters. And inside this folder we create index.js. And we write all our component logic inside this index file.

11. Writing business logic in component file

Good Practice

12. Not using logs in application

13. following props drilling

14. executing same code on multiple re-renders

Bad Practice
filter methods executed on every state change
memoized version
Filter is only executed once

15. using legacy JS code to access DOM elements

🌄

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store