Why does console.log need to wrapped before I can use it in an event handler?
https://jsfiddle.net/7e5yLh63/17/
In the example above, this code does nothing (line 44-51) when I click 'Add':
function ManufacturerWrapper() {
return <AddManufacturerForm onAddManufacturer={console.log} />
}
But when I change it to
function log(msg) {
console.log(msg);
}
function ManufacturerWrapper() {
return <AddManufacturerForm onAddManufacturer={log} />
}
It logs to the console as expected. Why can't I just pass in console.log
directly? Why do I need to wrap it in my own function first?
I'm using Firefox if that matters