Don't put everything inside React
You should split your logic and your reactive parts. This way, you can test your logic separately from your UI.
This is a good practice because it makes your code more maintainable and easier to understand.
It’s not forbidden to extract your logic into a separate function and call it from your component. In fact, it’s encouraged.
Instead of polluting your reactive code with logic and vice versa, you should keep them separate.
This way of thinking about your code is called "
Separation of Concerns"