Earlier quoted context omitted.
Pedantic and what always happens when someone posts code on the internet, but, I'd extract the onClick function and provide a default value for the onclick parameter for readability, and use cleverness to show off: export const Counter = ({label, counterType, onClick}) => { const [counter, setCounter] = useState(0); onClick = onClick || () => {}; const handleClick = () => { const modifier = counterType === "Increment…
You should also use useCallback for handleClick
See my extensive post "A (Mostly) Complete Guide to React Rendering) for details:
https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-...