I'm trying to render a certain number of divs based on the pageCount
value I have in my app. My approach is as follows
render() {
const { pageCount } = this.props;
function renderPages() {
for (let i = 0; i < pageCount; i++) {
return <div>{i}</div>;
}
}
return <div style={{ textAlign: "center" }}>{renderPages()}</div>;
}
So here pageCount
value i get is 5. I want to render 5 divs but when returning, the loop breaks. How can I fix this?