⚙️ XHubChatProvider Reference
Complete guide to setting up and configuring the provider.
Basic Setup
import { XHubChatProvider } from '@xhub-chat/react';
function App() {
return (
<XHubChatProvider
baseUrl="https://server.com"
accessToken="token"
userId="@user:server.com"
>
<YourApp />
</XHubChatProvider>
);
}
Props
interface XHubChatProviderProps {
baseUrl: string;
accessToken: string;
userId: string;
children: React.ReactNode;
// Optional
store?: IStoreOpts;
sync?: ISyncOpts;
timelineSupport?: boolean;
cryptoEnabled?: boolean;
}
Advanced Configuration
<XHubChatProvider
baseUrl="https://server.com"
accessToken={token}
userId={userId}
store={{
type: 'indexeddb',
dbName: 'my-app',
workerApi: true,
}}
sync={{
enabled: true,
slidingSync: true,
}}
>
<YourApp />
</XHubChatProvider>