The Connection.Provider
component manages connection state and provides context for all connection-related components. It provides:
- Centralized connection state management
- Translation context for internationalization
- Session token management
- Connection data sharing
Installation
Usage
"use client"
import { Connection } from "@runmorph/atoms";
function App({ sessionToken }) {
return (
<Connection.Provider sessionToken={sessionToken}>
<YourConnectionComponents />
</Connection.Provider>
);
}
export default App;
Props
The session token used to identify and manage the connection.
The child components that will have access to the connection context.
A translation function that receives a key and optional variables and
returns the translated string.
- key: The translation key to look up - vars: Optional variables for
string interpolation
The translated string or the original key if no translation is found
Context Values
The connection context provides:
sessionToken
: The current session token
t
: The translation function if provided
settings
: Any connection settings
status
: The current connection status
Internationalization
The provider supports translation keys for:
- Connection status messages
- Action buttons
- Error messages
- UI elements
Responses are generated using AI and may contain mistakes.