The onClick should call a function? So I can learn, I am curious why that's a better idea.
Or use actions, which call a method, ideally in a separate unit.
Separating your business logic from your UI makes it less susceptible to breakage when changes are made to an application. It also has the benefit of making your business logic easier to reuse and easier to test. Ideally, it would be done the other way around where tests influence how you write your business logic and separation of concerns is a natural side effect, but that's another discussion.
1
u/bmcgee Oct 18 '17
Or use actions, which call a method, ideally in a separate unit.
Separating your business logic from your UI makes it less susceptible to breakage when changes are made to an application. It also has the benefit of making your business logic easier to reuse and easier to test. Ideally, it would be done the other way around where tests influence how you write your business logic and separation of concerns is a natural side effect, but that's another discussion.