@s-ui/abtesting-toggle
v1.9.0
Published
> A React component that wraps a set of components and renders the one corresponding to `variation` key.
Downloads
1,846
Maintainers
Keywords
Readme
@s-ui/abtesting-toggle
A React component that wraps a set of components and renders the one corresponding to
variation
key.
<AbTestToggle variation="A">
<button variationId="A" >Green Button</button>
<button variationId="B" >Blue Button</button>
</AbTestToggle>
Installation
npm install @s-ui/abtesting-toggle --save
Usage
import AbTestToggle from '@s-ui/abtesting-toggle'
<AbTestToggle variation={variation}>
<button style="color: green;" variationId="A" >Green Button</button>
<button style="color: blue;" variationId="B" >Blue Button</button>
<button style="color: black;" defaultVariation >Black Button</button>
</AbTestToggle>
if
variation equals"A"then
Green Button is shown, as it hasvariationId
set to "A"if
variation="B"then
Green Button is shown, as it hasvariationId
set to "B"if
variation is not definedthen
Black Button is show, isdefaultVariation
is defined.