Salesforce Certified Platform Developer II — Question 236

As part of a custom interface, a developer team creates various new Lightning web components. Each of the components handles errors using toast messages. When the development is complete, all the components are added to the same Lightning page.

During acceptance testing, users complain about the long chain of toast messages that display when errors occur loading the components.

Which two techniques should the developer implement to improve the user experience? (Choose two.)

Answer options

Correct answer: A, B

Explanation

Option A is correct because using a [template] tag allows for displaying error messages directly within the component, enhancing user experience by keeping them in context. Option B is also correct as using public properties can effectively manage and display error messages within the components. Options C and D are not ideal; window.alert() disrupts the user experience by creating modal interruptions, and while aggregating errors in a single component (Option D) is useful, it doesn't address the immediate in-place error feedback which is more user-friendly.