<div style={"background-image: url("+imgUrl+")"}>  </div>
<div> style={{backgroundImage: "url("+imgUrl+")"}}  </div>
Another thing I needed to do was conditionally add a class to an element based on a state variable. Here's how that turned out:
<h2> className={visible ? 'hilited' : ''} </h2>




















 
 
 
 

 
 


 
 
 
 
 
 
 
 

 

 
 

 
 
 

 
 Posts
Posts
 
 
 
 
 
 
 
 
 
 
 
 
Post a Comment
Note: Only a member of this blog may post a comment.