// 1. Import the hook import { usePartyKit } from '@/hooks/usePartyKit'; // 2. Use in your component const { isConnected, lastMessage, sendMessage } = usePartyKit({ room: 'my-room', party: 'my-party' }); // 3. Send messages sendMessage('chat', { text: 'Hello!' }); // 4. Handle incoming messages useEffect(() => { if (lastMessage?.type === 'chat') { console.log(lastMessage.data.text); } }, [lastMessage]);