フリー問題

Salesforce Certified Platform Developer II のフリー問題 12 / 20 問目

問題文

A bicycle sharing service renders one child component per docking station inside a parent component. When the rider taps a row, the parent must know which station was chosen so it can show the bikes available there. Which implementation is correct?

選択肢

  1. Dispatch a CustomEvent from the child whose detail carries the station Id, and read event.detail in the parent's handler, because an event travels up to the component that placed the child in its own markup.
  2. Import the parent's module in the child and assign the station Id to a public property of the parent instance, and the parent reacts to the assignment.
  3. Publish the station Id on a message channel, because passing a value from a child to its own parent needs the message service whenever the value is an Id rather than a plain string.
  4. Dispatch a CustomEvent with no detail and let the parent read the child's private property through the shadow root once the event arrives, pulling the Id out.

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。