# setContactKey

Sets the contact key for the device's user.

## Syntax

```javascript
MCReactModule.setContactKey(contactKey);
```

## Parameters

| Parameter    | Type     | Description                                                  |
| ------------ | -------- | ------------------------------------------------------------ |
| `contactKey` | `string` | The value to be set as the contact key of the device's user. |

## Returns

- `void` - No return value.

## Example

```javascript
import { MCReactModule } from "react-native-marketingcloudsdk";

const setUserContactKey = () => {
  try {
    MCReactModule.setContactKey("user123@example.com");
    console.log("Contact key set successfully");
  } catch (error) {
    console.error("Error setting contact key:", error);
  }
};
```

## See Also

- [getContactKey() Method](/docs/marketing/mobile-unified-sdk/references/engagement-mobile-sdk-reference/react_getContactKey.md)
- *SDK Reference for Android*:[Identity Class](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/javadocs/SFMCSdk/8.0/-s-f-m-c%20-s-d-k/com.salesforce.marketingcloud.sfmcsdk.components.identity/-identity/set-profile-id.html)
- *SDK Reference for iOS*: [Identity Class](/docs/marketing/mobile-unified-sdk/references/engagement-mobile-sdk-reference/identity.md)
