MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / Button

Function Button

pkg/vdom/vdom_test.go:44–62  ·  view source on GitHub ↗
(ctx context.Context, props map[string]any)

Source from the content-addressed store, hash-verified

42}
43
44func Button(ctx context.Context, props map[string]any) any {
45 ref := UseVDomRef(ctx)
46 clName, setClName := UseState(ctx, "button")
47 UseEffect(ctx, func() func() {
48 fmt.Printf("Button useEffect\n")
49 setClName("button mounted")
50 return nil
51 }, nil)
52 compId := UseId(ctx)
53 testContext := getTestContext(ctx)
54 if testContext != nil {
55 testContext.ButtonId = compId
56 }
57 return Bind(`
58 <div className="#param:clName" ref="#param:ref" onClick="#param:onClick">
59 <bindparam key="children"/>
60 </div>
61 `, map[string]any{"clName": clName, "ref": ref, "onClick": props["onClick"], "children": props["children"]})
62}
63
64func printVDom(root *RootElem) {
65 vd := root.MakeVDom()

Callers

nothing calls this directly

Calls 6

UseStateFunction · 0.85
getTestContextFunction · 0.85
BindFunction · 0.85
UseVDomRefFunction · 0.70
UseEffectFunction · 0.70
UseIdFunction · 0.70

Tested by

no test coverage detected