Skip to content

Commit 7cf0932

Browse files
committed
update readme
1 parent ac8e621 commit 7cf0932

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,25 @@ npm add @aptabase/react-native
1616

1717
First, you need to get your `App Key` from Aptabase, you can find it in the `Instructions` menu on the left side menu.
1818

19-
Initialize the SDK by using the `AptabaseProvider` on your `App` component:
19+
Initialize the SDK by calling the `init` function before declaring your `App` component:
2020

2121
```js
22-
import { AptabaseProvider } from "@aptabase/react-native";
22+
import Aptabase from "@aptabase/react-native";
23+
24+
Aptabase.init("<YOUR_APP_KEY>"); // 👈 this is where you enter your App Key
2325

2426
export default function App() {
25-
return (
26-
<AptabaseProvider appKey="<YOUR_APP_KEY>">
27-
<Counter />
28-
</AptabaseProvider>
29-
);
27+
return <Counter />;
3028
}
3129
```
3230

33-
Afterwards, you can start tracking events with `trackEvent` from `useAptabase` hook:
31+
Afterwards, you can start tracking events with `trackEvent`:
3432

3533
```js
36-
import { useAptabase } from "@aptabase/react-native";
34+
import { trackEvent } from "@aptabase/react-native";
3735
import { useState } from "react";
3836

3937
export function Counter() {
40-
const { trackEvent } = useAptabase();
4138
const [count, setCount] = useState(0);
4239

4340
const increment = () => {
@@ -60,7 +57,7 @@ export function Counter() {
6057
}
6158
```
6259

63-
**Note for Expo apps:** Events sent during development while running on Expo Go will not have the `App Version` property because native modules are not available in Expo Go. However, when you build your app and run it on a real device, the `App Version` property will be available. Alternatively, you can also set the `appVersion` during the `AptabaseProvider` initialization so that it's available during development as well.
60+
**Note for Expo apps:** Events sent during development while running on Expo Go will not have the `App Version` property because native modules are not available in Expo Go. However, when you build your app and run it on a real device, the `App Version` property will be available. Alternatively, you can also set the `appVersion` during the `init` call so that it's also available during development.
6461

6562
A few important notes:
6663

0 commit comments

Comments
 (0)