開発者は、複数の Lightning Web コンポーネントを含むアプリを作成しています。 子コンポーネントの 1 つはナビゲーションの目的で使用されます。ユーザーが子コンポーネントの「次へ」というボタンをクリックすると、親コンポーネントに通知して次のページに移動できるようにする必要があります。 これをどのように達成すればよいでしょうか?
正解:D
To notify the parent component when the child component'sNextbutton is clicked, the child component can dispatch a custom event. The parent component listens to this event and handles navigation accordingly. Reference:Custom Events in LWC Incorrect Options: A:Properties in LWC are one-way data-bound; updates do not notify parents. B:Calling an Apex method is unnecessary for parent-child communication. C:Notifications are not a feature in LWC for component communication.