I have a render in my component that renders out many components and i want it to repeat some of them. The problem I have is when I create an HTML render the variable is not being processed and it is displaying as text.
The actual code contains many more componentsbut I have simplified it
MY code
export default function(props) {
const bookData = props.bookData;
const pageStart = props.pageStart;
// Create Diary HTML
const myLoop = (loopNumber, pageStart) => {
let html = '';
for (let i = 0; i < loopNumber; i++) {
let singleLoop = `<DiaryByDay loop={${i}} />`;
html = html + ' ' + singleLoop;
}
return html;
};
const dayByDayPages = myLoop(1, 3);
const dayByDayReturn = <Fragment> {dayByDayPages} </Fragment>
console.log(dayByDayReturn)
return (
dayByDayReturn
);
}
