Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Feature: Identify prop #67

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Feature: Identify prop #67

wants to merge 2 commits into from

Conversation

jacobmoretti
Copy link
Collaborator

@jacobmoretti jacobmoretti commented Jun 8, 2018

The current addition of identify via the exported utils is a bit cumbersome to setup and doesn't really follow the same flow when working with the component helpers.

In an attempt to improve upon this, an identify prop can be supplied to the FeatureFlag component. The identify prop takes in a user object, the same type defined here: https://github.com/TrueCar/react-launch-darkly#user--object-required. The main difference is you are not required to supply all of the properties, only the new properties you wish to re-identify the user to have.

<FeatureFlag identify={{ custom: { authenticated: this.state.authenticated } }} />

This is useful for use-cases where your state can change and you wish to re-identify the user seamlessly within your component. As the state changes, your feature flag components that depend upon it will get the updated prop passed down and will re-render as necessary.

@@ -86,6 +93,17 @@ export default class FeatureFlagRenderer extends Component<Props, State> {
});
}

identify (ldClient: LdClientWrapperType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should add a test for this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely, still trying to get these flow errors resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants