From e05425ed3a7e89c0a0977f2d8d1813a792d631ab Mon Sep 17 00:00:00 2001 From: Jaguar Zhou Date: Mon, 21 Oct 2024 18:50:22 +0800 Subject: [PATCH] fix: `` warns 'Each child in a list should have a unique "key" prop.' (#1806) --- src/TransWithoutContext.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/TransWithoutContext.js b/src/TransWithoutContext.js index 7e3d4844d..672e0cf25 100644 --- a/src/TransWithoutContext.js +++ b/src/TransWithoutContext.js @@ -362,6 +362,7 @@ export function Trans({ if (components) { Object.keys(components).forEach((c) => { + if (!components[c].key) components[c] = cloneElement(components[c], { key: c }); const comp = components[c]; if ( typeof comp.type === 'function' ||