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

Function Counter

src/py/reactpy/tests/test_core/test_serve.py:86–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84
85@reactpy.component
86def Counter():
87 count, change_count = reactpy.hooks.use_reducer(
88 (lambda old_count, diff: old_count + diff),
89 initial_value=0,
90 )
91 handler = STATIC_EVENT_HANDLER.use(lambda: change_count(1))
92 return reactpy.html.div({EVENT_NAME: handler, "count": count})
93
94
95@pytest.mark.skipif(sys.version_info < (3, 11), reason="ExceptionGroup not available")

Callers 1

test_dispatchFunction · 0.70

Calls 1

useMethod · 0.80

Tested by

no test coverage detected