web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PCF Component Tutorial...
Power Apps
Answered

PCF Component Tutorial issue

(1) ShareShare
ReportReport
Posted on by 482

Dear community,

 

I'm starting out with PCF components and following the official tutorial of Microsoft.

However, I'm stuck with an error I'm getting after running `npm run build`, and I can't seem to solve it. The error message I receive is 

 

EventListener is not defined

 

 and I was following the tutorial step by step.

Can someone point me in the right direction? I guess it's an easy fix for you guys.

 

Thanks in advance!

I have the same question (0)
  • Verified answer
    deepakMehta Profile Picture
    22 on at

    Follow below steps:

    1. remove or comment variable declaration buttonClickHandler i.e. 

        // private buttonClickHandler: EventListener;
    2. remove or comment the statement in methhod "init".  
     //this.buttonClickHandler = this.buttonClick.bind(this);
    and add statement 
      this.buttonClick = this.buttonClick.bind(this);
    3. Update method "init" to add event listener instead with variable this.buttonClickHandler to this.buttonClick  i.e. 
    button.addEventListener("click", this.buttonClick);
    4. update method "destroy" to remove event listener i.e. 
    this.container.querySelector("button")!.removeEventListener("click", this.buttonClick);
     
    It works for me with above changes. 
    Thanks
     
  • mrQ Profile Picture
    482 on at

    Hi @deepakMehta 

    You're a rockstar! That works, thank you. 

    Now we just need to get MS to fix it on their learning platform 😁

     

    Thanks again! I appreciate it.

  • James9456 Profile Picture
    8 on at

    Hi mrQ,

    You can add a comment at the end of your code to skip the eslint check.

     private myButtonHandler: EventListener;// eslint-disable-line

    Regards,

    James

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard