Targeting by Traits

This demo is easiest to understand if you open its source code in a parallel tab.

Source code

This demo shows how to use @happykit/flags for targeting by traits.

You can pass any traits into the flag evaluation. These traits can then be used by the rules defined in your flags. This allows you to resolve flags differently based on the provided traits.

Traits can be related to the visitor, to the authenticated user or to anything else. You can pass any traits you want. Use the traits in your HappyKit flag rules to resolve the flag to different variants based on the passed traits.

Render #1 (Current render)
{ flags: {}, data: null, error: "response-not-ok", fetching: false, settled: true, visitorKey: "OsQ9UO8YrN3Qjndg6rXrb" }

Note that aside from traits, HappyKit also has the concepts of a visitor and a user. These three concepts are all independent of each other.