I have created a component called "componentRepeater" who's job it is to render multiple instances of a child components. The props in that the "componentRepeater" contain includes the props for the child components and the number of repeats of the child component and the string (including props) for the child component.
The problem I am having is that once the string is completed it is rendering as text and therefore the component "componentRepeater" is not loading the required child components.
This is the code that initiates the component called "componentRepeater"
<ComponentRepeater
bookFormat={props.bookFormat}
data={timelineP2}
multiplayer='5'
childrenComponent='<PageTableTwoColumn bookFormat={props.bookFormat} data={timelineP2} />'
/>
This is the code for component called "componentRepeater"
import React, { Fragment } from 'react';
import Timeline from '../layout/page-table-two-column'
import PageTableTwoColumn from '../layout/page-table-two-column'
export default function(props) {
const multiplayer = props.multipalyer
const childrenComponent = props.childrenComponent
const myRender = (props) => {
var i;
var myOutput = props
for (i = 0; i < multiplayer-1; i++) {
myOutput = myOutput + props
}
return (myOutput)
}
return (
<Fragment>
{myRender}
</Fragment>
);
}