Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default type using useExperiment #26

Open
umarjavedpresize opened this issue Jun 8, 2021 · 1 comment
Open

Default type using useExperiment #26

umarjavedpresize opened this issue Jun 8, 2021 · 1 comment
Labels
question Further information is requested

Comments

@umarjavedpresize
Copy link

umarjavedpresize commented Jun 8, 2021

  • [Expected Behavior]
    There should be a default type when setting Variants so that if variant is not among the ones that are listed, default component/UI is shown
  • [Current Behavior]
  • Right now, it don't show anything

My requirements are only fulfilled using useExperiment hook and I can't find anything like defaultVariantName for this hook

@moretti
Copy link
Member

moretti commented Jun 9, 2021

This is already supported, but not well documented. The third argument of useExperiment is defaultVariantName:

const useExperiment = (experimentName, userIdentifier, defaultVariantName) => {

Here's an example:
https://codesandbox.io/s/react-ab-test-use-experiment-default-variant-g7iip

@moretti moretti added the question Further information is requested label Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants