Programming is often considered a craft rather than a job. There are good reasons for it too. We as developers should always try to achieve the best quality in any software we write. And there are some awesome principles to follow as a blueprint. One of my favorites is:** “DRY — Don’t Repeat Yourself”**

Today I will share 5 techniques that I use personally to avoid duplication of code in my project.

  • HTTP Calls
    • Fetching data inside component
    • Abstract away the logic into some kind of store
  • Error Handling
    • Error in HTTP call
    • Error in Component logic
    • Validation Error
  • Composition of Components
  • Use Custom Hooks
  • Avoid Duplicate Styling
    • Using .css files for styling components.
    • At this stage, I learned Sass

#programming #react #software-development #javascript

5 DRY Principles To Follow In React
8.35 GEEK