React alpha.3 is quite strict with type handling of components. I have a bunch of new errors for when it expects a function but gets an object or undefined back.
Uncaught (in promise) Error: Component's "onCancel" property should be a function, but got [object] instead
debug.module.js:1 Uncaught (in promise) Error: Component's "onFocus" property should be a function, but got [undefined] instead
Is this as expected? It would be fine if it were just in my code as I could fix it to never use onCancel={null}, but I'm getting errors back for dependencies I'm using, forcing me to add something like onFocus={()={}} even if I would prefer not to pass in that prop at all.
I'm looking into this, sorry for the inconvenience and thank you for reporting this.
A fix is on its way, thanks again for reporting this.
We'll likely publish our next alpha sooner than planned, because a few people ran into this. Stay tuned :tada:
That would be great, looking forward to the next alpha!
@jessicabyrne as promised we published alpha 4 which includes the fix for this issue :tada:
@marvinhagemeister it still catches false positives, e.g. in reactjs-popup where the Popup component has an on property that expects an array.
I stumbled on this because a component I wrote had a boolean property named online. It was quite puzzling that Preact required it to be a function; even more puzzling when it started working after renaming it to isOnline.
Perhaps the check at: https://github.com/developit/preact/blob/078e316c66812bb59d6fb80f74fa7039006eb371/debug/src/debug.js#L64
...could be made to check that the third letter is an uppercase character? Or print a warning instead of throwing an error?
@bard good catch 馃憤