From b02ffefb6d9b8240bdad8c7948886c7366bc7d45 Mon Sep 17 00:00:00 2001 From: Ahmad Salameh Date: Fri, 22 Nov 2024 17:45:05 +0300 Subject: [PATCH] fix: Attempted to assign to readonly property --- 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 ||