Hiyve Components - v1.0.0
    Preparing search index...

    Function useRoomFlow

    • Derives the current application screen from WebRTC connection state.

      Returns UseRoomFlowReturn

      The current screen name and individual boolean flags

      Composes useConnection, useRoom, useWaitForHost, and useWaitingRoom into a single screen value. This replaces the repeated if/else routing chains found in most example App.tsx files.

      import { useRoomFlow } from '@hiyve/react';
      import { WaitForHostScreen } from '@hiyve/react-ui';

      function App() {
      const { screen } = useRoomFlow();

      switch (screen) {
      case 'waiting-for-host':
      return <WaitForHostScreen />;
      case 'waiting-room':
      case 'waiting-room-rejected':
      return <WaitingScreen />;
      case 'connecting':
      return <ConnectingScreen />;
      case 'in-room':
      return <VideoRoom />;
      default:
      return <JoinForm />;
      }
      }