fix annoying react error "missing unique key prop"

This commit is contained in:
Eduard Heimbuch
2020-11-13 12:51:48 +01:00
committed by René Pfeuffer
parent 2087c27671
commit 6343eddeb3
2 changed files with 9 additions and 3 deletions

View File

@@ -52,7 +52,13 @@ const SplitAndReplace: FC<Props> = ({ text, replacements }) => {
if (parts.length === 0) {
return <>{parts[0]}</>;
}
return <>{parts}</>;
return (
<>
{parts.map((part, index) => (
<React.Fragment key={index}>{part}</React.Fragment>
))}
</>
);
};
export default SplitAndReplace;