MCPcopy Create free account
hub / github.com/LeetCode-OpenSource/ayanami / CountComponent

Function CountComponent

demo/index.tsx:88–106  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86InputComponent.displayName = 'InputComponent'
87
88function CountComponent() {
89 const [{ count, input }, actions] = useAyanami(Count)
90 const [{ tips }] = useAyanami(Tips)
91
92 const add = (count: number) => () => actions.add(count)
93 const minus = (count: number) => () => actions.minus(count)
94
95 return (
96 <div>
97 <p>count: {count}</p>
98 <p>input: {input}</p>
99 <p>tips: {tips}</p>
100 <button onClick={add(1)}>add one</button>
101 <button onClick={minus(1)}>minus one</button>
102 <button onClick={actions.reset}>reset</button>
103 <InputComponent />
104 </div>
105 )
106}
107
108ReactDOM.render(<CountComponent />, document.querySelector('#app'))

Callers

nothing calls this directly

Calls 3

useAyanamiFunction · 0.90
addFunction · 0.70
minusFunction · 0.70

Tested by

no test coverage detected