---
schema_version: "1"
id: f2980f986667ce0b3f346127d431e87f80804e262f2b98090d9d0481874822b3
title: autoDestroy()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/ref-jsapi/ref-jsapi-component-autodestroy.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/ref-jsapi-component-autodestroy.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1aa9a38bf9f06addc997ec318be776342dc88770f30be2eecd02df6e60a38c84
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# autoDestroy()

Sets a flag to tell the rendering service whether or not to destroy this component when it is removed from its rendering facet.

## Signature

`autoDestroy(Boolean destroy)`

## Parameters

**_destroy_**

Type: `Boolean`

Default is `true`, which marks the component to be destroyed when it’s orphaned. Set to `false` to keep a reference to a component after it has been unrendered or removed from a parent facet. We don't recommend setting the value to `false`. If you do, be careful to avoid memory leaks.

