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

Function use_connection

src/py/reactpy/reactpy/backend/hooks.py:11–23  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

9
10
11def use_connection() -> Connection[Any]: # nocov
12 """Get the current :class:`~reactpy.backend.types.Connection`."""
13 warn(
14 "The module reactpy.backend.hooks has been deprecated and will be deleted in the future. "
15 "Call reactpy.use_connection instead.",
16 DeprecationWarning,
17 )
18
19 conn = use_context(ConnectionContext)
20 if conn is None:
21 msg = "No backend established a connection."
22 raise RuntimeError(msg)
23 return conn
24
25
26def use_scope() -> MutableMapping[str, Any]: # nocov

Callers 2

use_scopeFunction · 0.70
use_locationFunction · 0.70

Calls 2

warnFunction · 0.90
use_contextFunction · 0.90

Tested by

no test coverage detected