I'm testing if it is possible to have a Button component which changes a 'counter' state, but the nature of the change depends on another state 'type'. Doing console log of the prop 'type' inside the Button component it appears to get correctly the content of it, but when passing it to a inner funtion 'handler', it turns to 'undefined'. Any idea of why this happens?
CodePudding user response:
Should be
const handler = (type, setCounter) =>`