import { useMyPresence, useOthers } from '@/liveblocks.config'; import { Cursor } from './cursor'; const TestPage = () => { const [myPresence, updateMyPresence] = useMyPresence(); const others = useOthers(); function handlePointerMove(e: any) { const cursor = { x: Math.floor(e.clientX), y: Math.floor(e.clientY) }; updateMyPresence({ cursor }); } function handlePointerLeave() { updateMyPresence({ cursor: null }); } return (
Cursor: {JSON.stringify(myPresence.cursor)} {others .filter((other) => other.presence.cursor !== null) .map(({ connectionId, presence }) => ( ))}
); }; export default TestPage;