Improving testability of your react components
If you ask any developer about tests, they answer that tests are essential. They indicate that the code works as intended and that your new change didn’t break something else. However, if you go into almost any React project, you can notice that thei...
kristijan-pajtasev.hashnode.dev10 min read
Hi Kristijan, pure functions handling business logic and smaller components are very useful software design concepts. Both also help to comply with a Single Responsibility Principle from SOLID. Each unit is doing its own job and has a single reason to change.
We strive to follow this in our huge codebase, too. Now with React hooks, we split it as follows:
This way everything is not just granularly separated and easy to test individually, but also very DRY (reusable).