Skip to main content

Overview

useIsTogether returns true when the user is currently connected to a React Together session, and false otherwise. This hook is essential for building connection-aware interfaces that adapt based on whether users are in a collaborative session.
Perfect for: Conditional rendering of collaborative features, connection status indicators, session-dependent logic, and graceful offline/online state handling.

Basic Usage

Signature

Return Value

boolean
true if the user is connected to a React Together session, false otherwise

Examples

Session-Dependent Feature Toggle

Show different UI based on connection status:

Connection Status Dashboard

Build a comprehensive connection monitoring component:

Smart Feature Loading

Conditionally load collaborative features only when connected:

Conditional Data Persistence

Handle data differently based on connection status:

Progressive Enhancement Pattern

Enhance basic functionality with collaborative features:

Best Practices

Connection State Management

Graceful Degradation

Common Patterns

  • Feature Flags: Use as a feature flag for collaborative functionality
  • Progressive Enhancement: Start with basic features, enhance when connected
  • Conditional Rendering: Show different UI based on connection status
  • Data Strategy: Switch between shared and local data based on connection
  • Performance: Avoid loading collaborative features when not needed

TypeScript Support

useIsTogether is fully typed and returns a boolean value:

Technical Notes

useIsTogether is an alias for useIsJoined from @multisynq/react. It returns true when the user has successfully joined a session and the connection is active.
Connection status can change during the session due to network issues. Always handle both connected and disconnected states gracefully in your UI.