react-launch-darkly icon indicating copy to clipboard operation
react-launch-darkly copied to clipboard

Feature: Identify prop

Open jacobmoretti opened this issue 7 years ago • 0 comments

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.

jacobmoretti avatar Jun 08 '18 20:06 jacobmoretti