What if you have a input component that may or may not use a change event?
James Bennett
1

This is loooong after your original comment, but for anybody else with the same questions: what I did about this was to set a default for the prop, so that if an “onClick” prop is not passed in, a handler is still present on the button itself. In my case, it is a function that does nothing, except during development it logs to the console that the click was not handled. I used this mainly because I had a Submit button that needs no click handler, but otherwise uses the same component. So my props looks like this:

props: {
onClick: {
default: function(event){
console.log("click not handled")
},
type: Function,
required: false
}
}
Like what you read? Give Mark Noonan a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.