How do I pass a function as a parameter without the function executing in the \"parent\" function or using eval()
? (Since I\'ve read that it\'s insecure.)
Some time when you need to deal with event handler so need to pass event too as an argument , most of the modern library like react, angular might need this.
I need to override OnSubmit function(function from third party library) with some custom validation on reactjs and I passed the function and event both like below
ORIGINALLY
MADE A NEW FUNCTION upload
and called passed onSubmit
and event as arguments
upload(event,fn){
//custom codes are done here
fn(event);
}