Design Patterns · Junior · Question 26 of 75
What does the Single Responsibility Principle (SRP) require?
- ✓Correct answer: A module should have one reason to change
- 2A module should contain exactly one function
- 3Each developer is responsible for only one module
Explanation
A component that loads data, formats it and draws a table changes for different reasons. Splitting it into a loading hook, formatting functions and a presentational component simplifies changes and tests. "One function" is a misreading.