React-jsonschema-form: Which field changed on onChange

Created on 13 Oct 2017  路  3Comments  路  Source: rjsf-team/react-jsonschema-form

I was wondering if there is anyway to know which field was changed when the onChange event is called. This would be pretty useful to avoid unnecessary validations/actions when this event is triggered.

I'm currently writing a Credit Card form, and I'm checking the card number as the user writes it, in order to show the card brand as soon as there are enough numbers to identify it. Right now, I'm using the onChange listener, and I'm looking for the card brand on every change the user makes. It would be way more efficient if this would be done only when the number field is changed.

Is there any way to achieve this?

Most helpful comment

This functionality is needed.

All 3 comments

At present, no, there's no indication of what field changed. A developer can of course check what fields are different between the old state and the current state if they need to, but I feel like in the particular use case you describe, I wouldn't want to compromise the functional approach just for a slight gain in efficiency.

This functionality is needed.

add second attribute that indicates current target?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mfulton26 picture mfulton26  路  3Comments

jabaren picture jabaren  路  3Comments

mammad2c picture mammad2c  路  3Comments

arnemahl picture arnemahl  路  3Comments

elyobo picture elyobo  路  3Comments