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:
- React components do just view rendering;
- Services (with pure functions inside) handle business logic;
- React hooks arranges business logic composition serving the view — they compose service operations.
This way everything is not just granularly separated and easy to test individually, but also very DRY (reusable).
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).