UNPKG

@wordpress/element

Version:
34 lines 1.12 kB
/** * Internal dependencies */ import { type Element as ReactElement } from './react'; /** * This function creates an interpolated element from a passed in string with * specific tags matching how the string should be converted to an element via * the conversion map value. * * @example * For example, for the given string: * * "This is a <span>string</span> with <a>a link</a> and a self-closing * <CustomComponentB/> tag" * * You would have something like this as the conversionMap value: * * ```js * { * span: <span />, * a: <a href={ 'https://github.com' } />, * CustomComponentB: <CustomComponent />, * } * ``` * * @param interpolatedString The interpolation string to be parsed. * @param conversionMap The map used to convert the string to * a react element. * @throws {TypeError} * @return A wp element. */ declare const createInterpolateElement: (interpolatedString: string, conversionMap: Record<string, ReactElement>) => ReactElement; export default createInterpolateElement; //# sourceMappingURL=create-interpolate-element.d.ts.map