ForceChallenges
ProblemsDailyNotesInterview
Sign in

Practice

All problemsSOQL practiceApex trigger challengesDaily challengeOpportunityTrigger.oldMapBefore UpdateBulkificationContactValidationGROUP BYSemi-JoinAccountBefore Insert

Interview questions

All questionsAdminAdministrationApexApex TriggerAsync ApexDevelopmentField ServiceField ServiceIntegrationLwc

By company

DeloitteSalesforceAccentureInfosysPwCCognizant

Learn

Study notes

ForceChallenges

AboutContact usPrivacy PolicyTerms of ServiceFor AI assistants (llms.txt)
© 2026 ForceChallenges · Salesforce SOQL & Apex trigger practice
Development questions5 of 102
DevelopmentMedium 1 min read

Why can renderedCallback run multiple times and how do you prevent repeated execution?

Answer

renderedCallback fires after every render, and any change to a reactive property used in the template triggers a re-render. Also, it runs for each component in the tree.

Pitfalls: one-time setup (loading a library, attaching listeners) would repeat, and changing a reactive property inside it can cause an infinite render loop.

Fix: use a guard flag:

javascript
renderedCallback() {
  if (this.initialized) return;
  this.initialized = true;
  // one-time DOM work
}

Put data loading in connectedCallback and avoid setting tracked state in renderedCallback unless guarded.

lwclifecyclerenderedcallback
Practice SOQL & Apex
PreviousHow do you use a third-party JavaScript library or static resource in LWC?Next How do you show a toast message in LWC?

More Development questions

  • What is reactivity in LWC and when does a field trigger a re-render?
  • What are the best practices to improve LWC performance?
  • How do you unit test an LWC with Jest?
  • How do you navigate to a record page or another page from an LWC?
  • What is Shadow DOM in LWC and how do you query elements inside a component?