I am learning React and having trouble in rendering list (ul>li's) using map function inside a UL JSX element inside a render function. I searched on internet but unable to resolve the issue.
Below is my component code:(in this component implementing the Pagination)
Code snippet:
//function returning list with values 1-total_pages e.g total_pages=5
make_pages_list = (start, end, step) => {
return Array.from(Array.from(Array(Math.ceil((end-start+1)/step)).keys()), x => start+ x*step);
}
render() {
return(
<div>
<div>Hi there
<form>
<input type="text"/>
<input type="submit"/>
</form>
</div>
........
//other JSX elements are also there
//then
<div>
<div className='ui container'>
<ul style={{listStyle: "none"}}>
{this.make_pages_list(1,this.state.total_pages, 1).map((n) =>{
<li key={n} id={n}><a href="#">{n}</a></li>
}
)}
</ul>
</div>
</div>
</div>
)
}
Additionally:
I have also the module "react-addons-create-fragment" but then style of ul is not working on it.
.map()function is not returning anything.