medipass / react-payment-inputs

A React Hook & Container to help with payment card input fields.
https://medipass.github.io/react-payment-inputs
342 stars 62 forks source link

onError handler not firing #10

Closed mrfelton closed 5 years ago

mrfelton commented 5 years ago

The onError handler doesn't seem to be firing.

<input {...getCardNumberProps({ onError: () => console.log('SOME ERROR') })} />

This never logs. Other handlers do work.

When is it supposed to fire? I would expect it to run if I type something invalid into the box.

mrfelton commented 5 years ago

This issue is that I was trying to set this at the field leve rather than as config to the hook itself. The following does work:

usePaymentInputs({ onError: handleOnError })