3 ms·
> That said, the magic with having a big options hash in the `@kea({})` call itself is that then you can easily disconnect the logic from your components as you
by spankalee 9y ago
> That said, the magic with having a big options hash in the `@kea({})` call itself is that then you can easily disconnect the logic from your components as your application grows. Here's more information about this: https://kea.js.org/guide/connected https://kea.js.org/guide/connected
Interesting. I still think these are better modeled (and read) as part of the class declaration. You can do the same thing with mixins:
Transforming that example:
import FeaturesLogic from '../features-logic.js';
@kea
class CounterExampleScene extends FeaturesLogic(Component) {
// no change here
}
Where FeaturesLogic is a JS class mixin: http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/ http://justinfagnani.com/2015/12/21/real-mixins-with-javascr...
export const FeaturesLogic = (base) => class extends base {
static actions = ...;
}
> Also, I'm not sure you can do `this.actions` inside a static variable, but I understand the point that you were trying to make.
Not in the current Babel transform, but I thought it may be in the latest unified class fields proposal. I'm digging for it...