1.0.0-canary.17 • Published 4 years ago
@socket-studio/preact v1.0.0-canary.17
React Tools for Socket Studio
Wrap the parts of your app that need Socket Studio access in the provider:
import { createSocketStudioClient, SocketStudioProvider } from '@socket-studio/react';
export function MyAppWrapper({ children }) {
const url = 'https://api.streamblitz.com/graphql';
const client = createSocketStudioClient(url);
return (
<SocketStudioProvider client={client}>
{children}
</SocketStudioProvider>
)
}
In any component wrapped by the provider, you can access Twitch chat data like so:
import { useTwitchChat } from '@socket-studio/react';
export function MyChat() {
const twitchChannel = 'jlengstorf';
const { chat, commands, currentCommand } = useTwitchChat(twitchChannel);
return (
<pre>{JSON.stringify({ chat, commands, currentCommand }, null, 2)}</pre>
)
}
1.0.0-canary.17
4 years ago
1.0.0-canary.16
4 years ago
1.0.0-canary.15
4 years ago
1.0.0-canary.13
5 years ago
1.0.0-canary.14
5 years ago
1.0.0-canary.12
5 years ago
1.0.0-canary.10
5 years ago
1.0.0-canary.11
5 years ago
1.0.0-canary.9
5 years ago
1.0.0-canary.8
5 years ago
1.0.0-canary.6
5 years ago
1.0.0-canary.7
5 years ago
1.0.0-canary.5
5 years ago
1.0.0-canary.4
5 years ago
1.0.0-canary.3
5 years ago
1.0.0-canary.2
5 years ago
1.0.0-canary.1
5 years ago
1.0.0-canary.0
5 years ago