- Create a Free Rollouts Account
- Create a React Application
- Install the Optimizely React SDK
- Implement a feature
- Rollout the feature!
Requirements: Node >= 8.1 and npm >= 5.6
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
/** | |
* Fetch and log a request | |
* @param {Request} request | |
*/ | |
async function handleRequest(request) { | |
try { |
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
/** | |
* Decision Worker | |
* | |
* Loads the datafile from KV Storage and makes a decision for the user. | |
* | |
* Decision worker deployed to: http://edge-kv-datafile.your-example-site.com/ |
import React, {Fragment} from 'react'; | |
import { StyleSheet, View, Text } from 'react-native'; | |
import { | |
createInstance, | |
OptimizelyProvider, | |
OptimizelyFeature, | |
enums, | |
setLogger, | |
} from '@optimizely/react-sdk' |
import React from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import { | |
createInstance, | |
OptimizelyProvider, | |
OptimizelyFeature, | |
} from '@optimizely/react-sdk' |
Requirements: Node >= 8.1 and npm >= 5.6
Our SDK uses the standard node http(s) request library, which unfortunately does not automatically pull in environment-defined proxy settings. I think the current options are:
Use global-agent to set the proxy settings for the http library so that requests from http use your proxy.
npm install --save global-agent
brew install node
brew install yarn
/* Complete code example of App.js by the end of the video */ | |
/* NOTE: Replace <Your_SDK_Key> with the SDK Key of your project below */ | |
import React from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import { | |
createInstance, | |
OptimizelyFeature, | |
OptimizelyProvider, | |
withOptimizely |
Requirements: Node >= 8.1 and npm >= 5.6