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

**Topic:** Development · **Difficulty:** Medium · **Tags:** lwc, lifecycle, renderedcallback

Read it on the site: https://www.forcechallenges.com/interview-questions/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.

---
Source: ForceChallenges · last updated 2026-10-19
