Loading tutorials
CustomEvent is, what its constructor accepts, and the mistakes people make before the event ever lea7 min read@api, and how to place one component inside another's template. The previous chapter showed how to build a CustomEvent. This chapter covers t6 min readnew CustomEvent(...). It assumes you can already write a child component that dispatches an event and a parent that listens for it. It also assumes you know that the parent's on<name> attribute connects to the child's event. The name looks l6 min readdetail property of a CustomEvent carries that information.6 min read@api properties and place one component inside another's template. It also assumes the child already dispatches a CustomEvent named productselected, as covered in the previous chapters. Here the focus is the receiving side: how a parent subscribes6 min read@api. It also assumes you have already seen how a child dispatches a CustomEvent and how a parent attaches onproductselected={handleProductSelected} in its template. Here the fo6 min readCustomEvent from a child component and handle it in a parent template with an on attribute such as onproductselected={handleProductSelected}. It also assumes you know the LWC lifecycle hooks connectedCallback, renderedCallback, and5 min readCustomEvent, dispatch it from a child with this.dispatchEvent, and handle it in the parent with an on<eventname> attribute. It also assumes you know that each LWC renders inside its own shadow tree. Here you will learn what the bubbles and `compo7 min readCustomEvent. It assumes you can write a child component that calls dispatchEvent, you know how @api properties work, and you have used describe, it, and expect in Jest. You also need `@salesforce/sfdx-lwc-5 min readCustomEvent, listen for it in a parent template, and read event.detail. It also assumes you know what bubbles and composed do. Here we collect the design decisions that keep events easy to understand, easy to test, and hard to misuse7 min readCustomEvent from a child and handle it in a parent template. It also assumes you know how bubbles and composed work and are comfortable with @api properties. The chapter covers the cases where a custom event is the wrong choice and names what t6 min read