Created
September 11, 2019 17:15
-
-
Save asaschachar/4cbe1ab4162129294403efd21103fb93 to your computer and use it in GitHub Desktop.
Capture The Flag - Complete Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import { | |
createInstance, | |
OptimizelyProvider, | |
OptimizelyFeature, | |
} from '@optimizely/react-sdk' | |
const optimizely = createInstance({ | |
sdkKey: '<Your_SDK_Key>', // TODO: Update to your SDK Key | |
}) | |
function App() { | |
return ( | |
<OptimizelyProvider | |
optimizely={optimizely} | |
user={{ | |
id: 'user123', | |
}} | |
> | |
<div className="App"> | |
<header className="App-header"> | |
<OptimizelyFeature feature="astronaut_feature"> | |
{(isEnabled) => ( | |
isEnabled | |
? <img src={"//optimize.ly/astronaut"} className="App-logo" alt="logo" /> | |
: <img src={logo} className="App-logo" alt="logo" /> | |
)} | |
</OptimizelyFeature> | |
<p> | |
Edit <code>src/App.js</code> and save to reload. | |
</p> | |
<a | |
className="App-link" | |
href="https://reactjs.org" | |
target="_blank" | |
rel="noopener noreferrer" | |
> | |
Learn React | |
</a> | |
</header> | |
</div> | |
</OptimizelyProvider> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment