React helpers for Google Optimize A/B testing.
npm install react-google-optimize-experimentHelpers for Google Optimize A/B testing.
```
npm i react-google-optimize
⚠️ You must have Google Optimize added to your application.
`javascript
import React from 'react';
import { Experiment, Variant } from 'react-google-optimize';
export default () => (
Default variant
);
``
Props:
- name: the experiment name configured in Google Optimize.
- loadingComponent: (optional) a component to be rendered while the variants are being requested from Google Optimize.
Props:
- default: sets this variant as the default. This value is used in case Google Optimize is not loaded or something fails.
- id: the variant id configured in Google Optimize.