Closed martijnvermaat closed 9 years ago
Ah yes, looks like it is used all over the place. Thanks for catching this one!
A simple renaming will probably do, but there might be places where you also still want to have a key
. I didn't look closely at that, but the key
for <option>
in SelectionField
should stay for example.
I had a quick look through the code and it seems that we'll want to duplicate the key
prop that is constructed in fields/make
into one that can be read within a render method. I think label
would fit nicely. Then every use of this.props.key
will have to be replaced by this.props.label
. We still want to keep setting the key
prop to disambiguate fields, so I won't be renaming key
when it's in the receiving position.
I'll get to this right away and see if anything breaks.
Fixed in d81ee5d.
From React 0.12 (I think),
key
andref
are now reserved prop names since passing them has a separate meaning. Hence, a component shouldn't try to readthis.props.key
.This is done in, for example,
InputField
andInputWrapper
where it indeed yieldsundefined
.I think the original idea behind using
key
here is still useful (e.g., to properly setid
andhtmlFor
), but a different property name should be used.