I wrote a functional component that compiles form fields for certain conditions. The form fields are their own component. So I have three levels:
<FormComponent> // handles input events
<FunctionalComponent> // selects form fields
<FormFieldComponent> // emits input events
</FunctionalComponent>
</FormComponent>
Functional components have no this
, but get a context object as argument to the render function. What I could do is using context.data.on[eventName](event)
or some similar construct. I also know that I could use an event bus or the dom elements directly, like described here.
All this looks rather dirty to me.
Is there any this.$emit
equivalent in functional components?