how can add class content's <div> if expiry_date null or undefined? challenging because have filter , map, i'm lost. 
{openapplymodal && <confirmmodal            visible={openapplymodal}           title={'take task'}           handlecancel={this.handlecancelapply}           handleok={this.handleapplyad}           loading={loading}           error={error}           content={             <div>               {error ? error :               <div>                 <p>{ads.filter(obj => obj._id === this.state.selectedad_id).map(obj => obj.expiry_date ? `you have complete task in ${fromnow(moment(obj.expiry_date))}` : '' )}</p>               </div>}             </div>           }         />}   there's nothing wrong above code, worked, output '' if expiry_date not present leave empty modal that's why i'm thinking of add hide class div.
add additional filter getting rid of items have null expiry_date ads array before mapping out in jsx:
content={  <div>  {error ? error :   <div>    <p>{ads         .filter(obj => obj._id === this.state.selectedad_id)         .filter(obj => !!obj.expiry_date)         .map(obj => `you have complete task in ${fromnow(moment(obj.expiry_date))}`)}   </p>    </div>}  </div> }   does solve problem? if not, please let me know did have in mind.
Comments
Post a Comment