-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathapp.jsx
More file actions
43 lines (36 loc) · 785 Bytes
/
app.jsx
File metadata and controls
43 lines (36 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { useEffect } from 'react';
import { IntercomProvider, useIntercom } from 'react-use-intercom';
const INTERCOM_APP_ID = 'jcabc7e3';
export function App() {
return (
<IntercomProvider
appId={INTERCOM_APP_ID}
autoBoot
onShow={() => alert('show')}
>
<OurApp />
</IntercomProvider>
);
}
function OurApp() {
return (
<main>
<p>Our App</p>
<TrackEvent />
</main>
);
}
function TrackEvent() {
const { trackEvent, boot, shutdown } = useIntercom();
useEffect(() => {
trackEvent('event');
}, [trackEvent]);
return (
<>
<p>Tracing event in effect</p>
<button onClick={() => boot()}>Boot</button>
<button onClick={() => shutdown()}>Shutdown</button>
</>
);
}
export default App;