react iterate

React Import, {from} the Component 'REACT' 
class the App the extends the Component { 
  constructor (The props) { 
    Super (The props) 
    the this .STATE = { 
      List: [ "Monday", "Tuesday", "Wednesday" ] 
    } 
  } 
  the render () { 
    return (
       <div> 
        <div> 
          { 
            // REACT there is no command, through the array using the map method only 
            the this .state.list.map ((Item, I) => {
               // return to add a tag label key, typically with the array index key 
              return <key P = {I}> {Item} </ P>
             }) 
          }
         </ div> 
      </ div>    )
  }
}


export default App;

 

Guess you like

Origin www.cnblogs.com/luguankun/p/11020592.html