MCPcopy Create free account
hub / github.com/cosdensolutions/code / Demo

Function Demo

videos/long/learn-react-hooks-useReducer/index.tsx:39–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39export default function Demo() {
40 const [state, dispatch] = useReducer(reducer, {
41 count: 0,
42 error: null,
43 });
44
45 return (
46 <div className='tutorial'>
47 <div>Count: {state.count}</div>
48 {state.error && <div className='mb-2 text-red-500'>{state.error}</div>}
49 <button className='mb-2' onClick={() => dispatch({ type: 'increment' })}>
50 Increment
51 </button>
52 <button onClick={() => dispatch({ type: 'decrement' })}>Decrement</button>
53 </div>
54 );
55}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected