Removed numeric key code
Brian Vaughn committed
Feb 19, 2019 at 08:59 UTC
a31415011d46d7be3302ad12777df04170adb382
1 file changed
+4
-8
src/backend/renderer.js
+4
-8
@@ -565,14 +565,10 @@ export function attach(
565
}
566
567
if (key !== null) {
568
- if (typeof key === 'number') {
569
- // unreachable code?
570
- // https://github.com/facebook/react/blob/master/packages/react/src/ReactElement.js#L187
571
- encodedKey = new Uint8Array(1);
572
- encodedKey[0] = key;
573
- } else {
574
- encodedKey = utfEncodeString(key);
575
- }
568
+ // React$Key supports string and number types as inputs,
569
+ // But React converts numeric keys to strings, so we only have to handle that type here.
570
+ // https://github.com/facebook/react/blob/0e67969cb1ad8c27a72294662e68fa5d7c2c9783/packages/react/src/ReactElement.js#L187
571
+ encodedKey = utfEncodeString(((key: any): string));
572
}
573
574
const encodedDisplayNameSize =