From 2d00f347befd760a5f3b5a209e6208ebff54f3dd Mon Sep 17 00:00:00 2001 From: Ahmad Salameh Date: Tue, 26 Nov 2024 12:56:33 +0300 Subject: [PATCH] fix: Attempted to assign to readonly property (#1813) --- src/TransWithoutContext.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TransWithoutContext.js b/src/TransWithoutContext.js index 672e0cf25..8d25e20eb 100644 --- a/src/TransWithoutContext.js +++ b/src/TransWithoutContext.js @@ -362,8 +362,8 @@ 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]; + const componentKey = components[c].key || c; + const comp = cloneElement(components[c], { key: componentKey }); if ( typeof comp.type === 'function' || !comp.props ||