in 07 - Returning State/01 - Stateful Functions.js [8:18]
function handleClick(props, state, event) {
if (event.button === 1) {
// Middle click resets state to zero
return { count: 0 };
}
// Callbacks to external components may be fired
if (props.onClick) {
props.onClick();
}
return { count: state ? state.count + 1 : 0 };
}