Skip to content

Commit a70487a

Browse files
authored
Merge pull request #5405 from segmentio/niall/rn_traits
Add/Remove traits for RN
2 parents f7120aa + 61b0314 commit a70487a

File tree

1 file changed

+14
-0
lines changed
  • src/connections/sources/catalog/libraries/mobile/react-native

1 file changed

+14
-0
lines changed

src/connections/sources/catalog/libraries/mobile/react-native/index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,5 +727,19 @@ The React Native 2.0 library is compliant with Google Play Store policies. Howev
727727
### Can I set inlineRequires to false in my metro.config.js file?
728728
Segment requires the `inlineRequires` value in your `metro.config.js` value to be set to `true`. To disable `inlineRequires` for certain modules, you can specify this by using a [blockList](https://facebook.github.io/metro/docs/configuration/#:~:text=If%20inlineRequires%20is%20an%20object){:target="_blank"}.
729729
730+
### Can I clear user traits without calling the reset() method?
731+
The set method on userInfo can accept a function that receives the current state and returns a modified desired state. Using this method, you can return the current traits, delete any traits you no longer wish to track, and persist the new trait set.
732+
733+
```js
734+
segmentClient.userInfo.set((currentUserInfo) => {
735+
return {
736+
...currentUserInfo,
737+
traits: {
738+
// All the traits except the one you want to delete
739+
persistentTrait: currentUserInfo.persistentTrait
740+
}
741+
});
742+
```
743+
730744
## Changelog
731745
[View the Analytics React Native changelog on GitHub](https://github.com/segmentio/analytics-react-native/releases){:target="_blank"}.

0 commit comments

Comments
 (0)