Created
February 8, 2022 22:38
-
-
Save nikolasleblanc/33a2a1fa3942510dbd0424c86f997344 to your computer and use it in GitHub Desktop.
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
/* | |
1. Create a new project with create-react-app | |
2. yarn add @devcycle/devcycle-react-sdk | |
3. Replace src/App.js with the following | |
4. enter your envKey and variableKey | |
*/ | |
import logo from './logo.svg'; | |
import './App.css'; | |
import { useDVCVariable, withDVCProvider } from '@devcycle/devcycle-react-sdk' | |
// change these | |
const envKey = 'envKey' | |
const variableKey = 'variableKey' | |
function App() { | |
const variable = useDVCVariable(variableKey, false) | |
return ( | |
<div className="App"> | |
<header className="App-header"> | |
<img src={logo} className="App-logo" alt="logo" /> | |
<p>{variable.value ? "Variable is true" : "Variable is false"}</p> | |
<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> | |
); | |
} | |
export default withDVCProvider({ | |
envKey, | |
user: { isAnonymous: true }, | |
})(App) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment