-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Improved readme. Simplified main and App code.
- Loading branch information
Showing
3 changed files
with
25 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,15 @@ | ||
import { useState } from 'react' | ||
import { useFlags } from 'launchdarkly-react-client-sdk' | ||
import reactLogo from './assets/react.svg' | ||
import viteLogo from '/vite.svg' | ||
import './App.css' | ||
import { useFlags } from 'launchdarkly-react-client-sdk'; | ||
|
||
function App() { | ||
const [count, setCount] = useState(0) | ||
const { booleanFlag1 } = useFlags() | ||
// README: replace yourFlagKey with your own flag key | ||
const { yourFlagKey: flagKey } = useFlags(); | ||
|
||
return ( | ||
<> | ||
<div> | ||
<a href="https://vitejs.dev" target="_blank"> | ||
<img src={viteLogo} className="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://react.dev" target="_blank"> | ||
<img src={reactLogo} className="logo react" alt="React logo" /> | ||
</a> | ||
</div> | ||
<h1>Vite + React</h1> | ||
<p>{booleanFlag1 ? <b>Flag on</b> : <b>Flag off</b>}</p> | ||
<div className="card"> | ||
<button onClick={() => setCount((count) => count + 1)}>count is {count}</button> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to test HMR | ||
</p> | ||
</div> | ||
<p className="read-the-docs">Click on the Vite and React logos to learn more</p> | ||
</> | ||
) | ||
} | ||
<div style={{ backgroundColor: flagKey ? 'green' : 'red' }}> | ||
The feature flag evaluates to <b>{flagKey ? 'true' : 'false'}</b> | ||
</div> | ||
); | ||
} | ||
|
||
export default App | ||
|
||
export default App; |
This file contains 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