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

Function Trigger

src/py/reactpy/tests/test_core/test_layout.py:560–575  ·  view source on GitHub ↗
(set_reverse_children, name)

Source from the content-addressed store, hash-verified

558
559 @reactpy.component
560 def Trigger(set_reverse_children, name):
561 if name == "good":
562
563 @good_handler.use
564 def callback():
565 called_good_trigger.current = True
566 set_reverse_children()
567
568 else:
569
570 @bad_handler.use
571 def callback():
572 msg = "Called bad trigger"
573 raise ValueError(msg)
574
575 return reactpy.html.button({"on_click": callback, "id": "good"}, "good")
576
577 async with reactpy.Layout(RootComponent()) as layout:
578 await layout.render()

Callers 1

RootComponentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected