MCPcopy Create free account
hub / github.com/QuarkGluonPlasma/react-course-code / App

Function App

hook-test/src/App3.tsx:28–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26}
27
28function App() {
29 const [res, dispatch] = useReducer<Reducer<Data, Action>, string>(reducer, 'zero', (param) => {
30 return {
31 result: param === 'zero' ? 0 : 1
32 }
33 });
34
35 return (
36 <div>
37 <div onClick={() => dispatch({ type: 'add', num: 2 })}>加</div>
38 <div onClick={() => dispatch({ type: 'minus', num: 1 })}>减</div>
39 <div>{res.result}</div>
40 </div>
41 );
42}
43
44export default App;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected