---
schema_version: "1"
id: 89892f33748bbd6ed62a80112e7c0a868621bb48b7818a4cdfe30aca4839cdc7
title: clearAttribute
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud-mobilepush/engagement_sdk/references/react/react_clearAttribute.md
canonical_url: https://developer.salesforce.com/docs/marketing/mobile-unified-sdk/references/engagement-mobile-sdk-reference/react_clearAttribute.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: f3f140ed23e1a7f5f855770a05ac4c3a4173d65c0b22638587ac89c20ea645a3
products:
  - Salesforce Engagement SDK
---
# clearAttribute

Clears the value of an attribute in the registration.

## Syntax

```javascript
MCReactModule.clearAttribute(key);
```

## Parameters

| Parameter | Type     | Description                                                                  |
| --------- | -------- | ---------------------------------------------------------------------------- |
| `key`     | `string` | The name of the attribute whose value must be cleared from the registration. |

## Returns

- `void` - No return value.

## Example

```javascript
import { MCReactModule } from "react-native-marketingcloudsdk";

const clearUserAttribute = () => {
  try {
    MCReactModule.clearAttribute("userType");
    console.log("Attribute cleared successfully");
  } catch (error) {
    console.error("Error clearing attribute:", error);
  }
};
```

## See Also

- [getAttributes() Method](https://developer.salesforce.com/docs/marketing/mobile-unified-sdk/references/engagement-mobile-sdk-reference/react_getAttributes.md)
- [setAttribute() Method](https://developer.salesforce.com/docs/marketing/mobile-unified-sdk/references/engagement-mobile-sdk-reference/react_setAttribute.md)
