Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Simplify readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jdorn committed Mar 31, 2021
1 parent 8c04c5b commit e058da6
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,16 @@ or

## Quick Usage

Step 1: Wrap your app in a GrowthBookProvider
Step 1: Wrap your app in GrowthBookProvider
```tsx
import {GrowthBookClient, GrowthBookProvider} from '@growthbook/growthbook-react';

// Instantiate a client
const client = new GrowthBookClient();

export default function App() {
// Get the user id from your auth system
const {userId} = useAuth();

// Store a GrowthBookUser object in state
const [growthBookUser, setGrowthBookUser] = useState(null);
useEffect(() => {
setGrowthBookUser(userId ? client.user({id: userId}) : null);
}, [userId])
// TODO: Pull user id from your auth system (or use an anonymous cookie id)
const user = client.user({id: "1"});

// Wrap your app in a GrowthBookProvider component
return (
Expand Down

0 comments on commit e058da6

Please sign in to comment.