MCPcopy Create free account
hub / github.com/Klerith/react-hooks / CounterWithCustomHook

Function CounterWithCustomHook

src/01-useState/CounterWithCustomHook.jsx:3–19  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { useCounter } from '../hooks/useCounter';
2
3export const CounterWithCustomHook = () => {
4
5 const { counter, increment, decrement, reset } = useCounter();
6
7
8 return (
9 <>
10 <h1>Counter with Hook: { counter }</h1>
11 <hr />
12
13 <button onClick={ () => increment(2) } className="btn btn-primary">+1</button>
14 <button onClick={ reset } className="btn btn-primary">Reset</button>
15 <button onClick={ () => decrement(2) } className="btn btn-primary">-1</button>
16
17 </>
18 )
19}

Callers

nothing calls this directly

Calls 3

useCounterFunction · 0.90
incrementFunction · 0.85
decrementFunction · 0.85

Tested by

no test coverage detected