Skip to content

Commit 37f201e

Browse files
authored
updates react package readme usage section (#366)
1 parent bdf4273 commit 37f201e

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

packages/react/README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,18 @@ import { VoiceProvider } from '@humeai/voice-react';
4646

4747
## Usage
4848

49-
### Quickstart
49+
> :rocket: Visit our [Next.js quickstart](https://dev.hume.ai/docs/speech-to-speech-evi/quickstart/nextjs) for step-by-step setup instructions and example code to jumpstart your development.
50+
51+
### Context Provider
5052

5153
To use the SDK, wrap your components in the `VoiceProvider`, which will enable your components to access available voice methods. Here's a simple example to get you started:
5254

5355
```tsx
5456
import { VoiceProvider } from '@humeai/voice-react';
5557

56-
function App() {
57-
const apiKey = process.env.HUME_API_KEY;
58-
58+
function Page() {
5959
return (
60-
<VoiceProvider
61-
auth={{ type: 'apiKey', value: apiKey }}
62-
configId={/* Optional: Your EVI Configuration ID */}
63-
>
60+
<VoiceProvider>
6461
{/* ... */}
6562
</VoiceProvider>
6663
);
@@ -119,17 +116,22 @@ After you have set up your voice provider, you will be able to access various pr
119116
For example, to include a button to start a call, you could create a button like this:
120117

121118
```tsx
119+
'use client'
122120
import { useVoice } from '@humeai/voice-react';
123121

124-
export function StartCallButton() {
122+
export function StartCall({
123+
accessToken,
124+
}: {
125+
accessToken: string;
126+
}) {
125127
const { connect } = useVoice();
126128

127129
return (
128130
<>
129131
<button
130132
onClick={() => {
131133
void connect({
132-
auth: { type: 'accessToken', value: '<YOUR_ACCESS_TOKEN>' },
134+
auth: { type: 'accessToken', value: accessToken },
133135
configId: '<YOUR_CONFIG_ID>',
134136
// other configuration props go here
135137
});

0 commit comments

Comments
 (0)