index.tsx 455 B

123456789101112131415
  1. import React from 'react';
  2. import { useSocket } from '../../hooks/socket';
  3. import { Gmus } from '../gmus';
  4. import { Identify } from '../identify';
  5. export const Root: React.FC = () => {
  6. const { name, onIdentify, socket, connecting, connected, error } = useSocket();
  7. if (!(socket && connected && name) || error) {
  8. return <Identify connecting={connecting} onIdentify={onIdentify} />;
  9. }
  10. return <Gmus myClientName={name} socket={socket} />;
  11. };