Simple hoc to provide a/b-test features.
npm install react-experiment-hoc

```
withExperiment(experiment-name, [options])(Component)
| Name | Description | Type | Default |
|------|-------------|------|---------|
| persistent | Wheter the experiment should be persistant for sesions. -1 evaluate on every render, 0 evaluate on every session, 1 evaluate once. | int | 1 |
| autoPlay | Auto play experiment on render | bool | false |
| fallbackName | Name of the fallback variation if fetch fails | string | 'original' |
| propPrefix | Prefix for the prop names passed to BaseComponent | string | null |
| onFetch | Fetch method returns variations of the given experiment | function
| onPlay | Trigger play | function
| onWin | Trigger win | function
| setCookie | Set cookie method | function | js-cookie.set |
| getCookie | Get cookie method | function | js-cookie.get |
js
import { ExperimentContext, withExperiment } from 'react-experiment-hoc';// App
const App = () => (
This app is running experiments!
);
// Original component
const Btn = ({experimentWin,experimentVariant: v}) => (
opacity: !v ? 0 : 1,
background: v === 'green-cta' ? 'green' : '',
}}
onClick={experimentWin}>
PRESS ME!
)
// Apply the experiments
const ExperimentBtn = withExperiment('new-cta-colors', {
autoPlay: true
})(Btn)
render( , document.getElementById("root"));
``