MCPcopy Index your code
hub / github.com/reactive-python/reactpy / use_connection

Function use_connection

src/py/reactpy/reactpy/core/hooks.py:256–262  ·  view source on GitHub ↗

Get the current :class:`~reactpy.backend.types.Connection`.

()

Source from the content-addressed store, hash-verified

254
255
256def 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
265def use_scope() -> MutableMapping[str, Any]:

Callers 2

use_scopeFunction · 0.70
use_locationFunction · 0.70

Calls 1

use_contextFunction · 0.85

Tested by

no test coverage detected