From dff7130b8c5f1a5f7d3cc5168eb887708ebcb08c Mon Sep 17 00:00:00 2001 From: aiktb Date: Mon, 21 Oct 2024 17:15:24 +0800 Subject: [PATCH] fix: `` warns 'Each child in a list should have a unique "key" prop.' --- src/TransWithoutContext.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/TransWithoutContext.js b/src/TransWithoutContext.js index 7e3d4844..672e0cf2 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' ||