Czesc pisze apke w react + redux i mam pewna rozkmine. Czy praktywanie czegos takiego, jak ww. temacie postu jest ok czy raczej jest to anty pattern ? Chodzi o mniej wiecej cos takiego:
// logika biznesowa
class SomeBusinessClass extends BusinessLogic {
contstructor(name, lastname, dispatcher) {
this.name = name;
this.lastname = lastname;
this.dispatcher = dispatcher;
}
someMethod() {
// business some logic
this.dispatcher(someAction());
}
}
// komponent reactowy
class SomeComponent extends React.Component {
componentDidMount() {
this.businessValue = new SomeBusinessClass('Jan', 'Kowalski', this.props.dispatch)
}
onClick() {
// component logic
this.businessValue.someMethod();
}
}
Dzieki wielkie za odp. i dyskusje
Pozdr.