게임 방 생성을 위한 커스텀 훅입니다.

const Component = () => {
const { isExiting, transitionTo } = usePageTransition();
const createRoom = useCreateRoom();

const handleCreateRoom = async () => {
const response = await createRoom.mutateAsync();
transitionTo(`/lobby/${response.data.roomId}`);
};

return (
<Button
onClick={handleCreateRoom}
disabled={createRoom.isPending || isExiting}
>
만들기
</Button>
);
};
  • Returns {
        createRoom: (() => Promise<any>);
        isLoading: boolean;
    }

    mutation 객체를 반환합니다. onSuccess 핸들러는 컴포넌트에서 처리해야 합니다.

    • createRoom: (() => Promise<any>)
        • (): Promise<any>
        • Returns Promise<any>

    • isLoading: boolean