peerlibrary/meteor-blaze-components

Could I use "AutoForm.hook()" in the Blaze Component?

thearabbit opened this issue · 3 comments

Could I use "AutoForm.hook()" in the Blaze Component?

class ExampleComponent extends BlazeComponent {
  // Life-cycle hook to initialize component's state.
  onCreated() {
    // It is a good practice to always call super.
    super.onCreated();
    this.counter = new ReactiveField(0);
  }
  autoformHook:{.............}
mitar commented

I don't know what that does.

I would like to use state in this template with AutoForm.hooks({........}).
Before I declare the global reactiveVar.

mitar commented

Interesting idea. I have not tried that. But I guess you could do something like:

AutoForm.addHooks(ExampleComponent.componentName(), ExampleComponent.prototype)

After the declaration of your component. And then component methods matching the name of class would be called for you. I am just not sure if this will be the component or something else.

Maybe @aldeed can help here more.