Is there any better way to pass function to props with LitElement?
12:43 18 Sep 2019

I'm using Polymer LitElement and I tried to pass a function to props, but it didn't work.
This is the way I found to work, but it's awful... Any better suggestions?

import { LitElement, html, customElement, property } from 'lit-element';

@customElement('my-element')
export class MyElement extends LitElement {
  onButtonClick = function name (){
    console.log("Clicked!!")
  }

  render() {
    return html`
      
    `;
  }
}

@customElement("c-button")
export class CButton extends LitElement{
  @property() text;
  @property() onClick;

  handleClick(){
    let fct = eval(`( ${this.onClick} )` )
    fct();
  }

  render(){
    return html`
       
    `
  }
}

javascript html polymer lit-element lit