Get the current :class:`~reactpy.backend.types.Connection`.
()
| 254 | |
| 255 | |
| 256 | def use_connection() -> Connection[Any]: |
| 257 | """Get the current :class:`~reactpy.backend.types.Connection`.""" |
| 258 | conn = use_context(ConnectionContext) |
| 259 | if conn is None: # nocov |
| 260 | msg = "No backend established a connection." |
| 261 | raise RuntimeError(msg) |
| 262 | return conn |
| 263 | |
| 264 | |
| 265 | def use_scope() -> MutableMapping[str, Any]: |
no test coverage detected