Skip to content

Commit

Permalink
Fix React warnings in TranslateWithMarkup
Browse files Browse the repository at this point in the history
Fixes #1578
  • Loading branch information
swissspidy committed Oct 10, 2020
1 parent d90e20e commit cb7719f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assets/src/i18n/translateWithMarkup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* External dependencies
*/
import { cloneElement, createElement } from 'react';
import { cloneElement, createElement, Fragment } from 'react';
import PropTypes from 'prop-types';

/** @typedef {import('react').React.ReactNode} ReactNode */
Expand Down Expand Up @@ -121,7 +121,7 @@ function TranslateWithMarkup({ mapping = {}, children }) {
return transform(
new DOMParser().parseFromString(children, 'text/html').body.firstChild,
mapping
);
).map((element, index) => <Fragment key={index}>{element}</Fragment>);
}

TranslateWithMarkup.propTypes = {
Expand Down

0 comments on commit cb7719f

Please sign in to comment.