Development questions
What are the best practices to improve LWC performance?
DevelopmentMedium
- Prefer Lightning Data Service and cacheable
@wirecalls to avoid redundant server trips. - Fetch only needed fields and records; paginate large lists.
- Use
lwc:ifto avoid rendering hidden content, and lazy-load heavy children. - Provide stable keys in
for:eachfor efficient diffing. - Avoid heavy logic in getters (they run on each render) and avoid DOM manipulation in
renderedCallback. - Debounce user input handlers (e.g. search).
- Don't mutate reactive properties unnecessarily to prevent extra re-renders.
- Load third-party scripts once and bundle assets as static resources.
- Clean up listeners and subscriptions in
disconnectedCallback.
lwcperformancebest-practices
More Development questions
- What is an Apex Trigger in Salesforce and when should you use it over Flows?
- What is the difference between before triggers and after triggers?
- Explain all Trigger context variables (isInsert, isUpdate, isDelete, isUndelete, isBefore, isAfter, isExecuting, size, operationType).
- What is the difference between Trigger.new and Trigger.old?
- In which trigger events are Trigger.new and Trigger.newMap available?
- In which trigger events are Trigger.old and Trigger.oldMap available?