reactjs - Looping in JSX files -
i trying render dynamic list of elements using react, i.e. have javascript array elems = ['foo','bar'] , generate
<ul> <li>foo</li> <li>bar</li> </ul> i purely in jsx. there convenient way (an "equivalent" of angular ng-repeat)?
the beauty of react/jsx write javascript. if have list of things , want create list of components, map list:
<ul> {items.map(item => <li>{item}</li>)} </ul> (and it's concise arrow functions)
Comments
Post a Comment