Posts

Showing posts from August, 2020

Embed JSX code with if condition in React app

     renderPrice(pt)  {    if (pt.amountpaid!="") {        let ctrl = (           <>             <div>                 <label>Price</label><br/>                 <input type="text" readOnly name="amountpaid" value={pt.amountpaid} />             </div>           </>          );          return ctrl;     } //end if } //end renderPrice render () {   const   priceElement  =  this . renderPrice ( purchasetransaction ); return  (                  < div   style = { { marginTop :   '5em' , marginLeft : '2em' } } >                                                               { priceElement }                      < p ></ p >    </ div >         )     }  //end render