React conditional rendering

17 == "conditions rendering 
 state initialization which generally written in the constructor 

CharShop.js following 

Import React, {from} the Component " REACT " ; 
Export default class CharShop the extends the Component {
     // state initialization which generally written in the constructor 
    constructor (props) { 
        Super (The props); 
        the this .STATE = { 
            Goods: [{ID: . 1, text: "web111"}, {ID: 2, text: "web222"}, {ID:. 3, text: "web333" }] 
        } 
    } 

     the render () { 
        //   Get state of the contents 
         the let CON = the this .state.goods [0] .text <h1 of> {? the this .state.goods [0] .text} </ h1 of>:conditions render null //

         return(
             <div>
               {con}
             </div>
         )
     }

}

 

Guess you like

Origin www.cnblogs.com/IwishIcould/p/11966808.html