I am trying to display profile images from a list of profiles using the indivdual's profile props but I can not reach the props in the setup for some reason. It works fine for the name and title but when I try to use the profileimage url as source it reads as undefined if I use the example from the answer here React JSX: Access Props in Quotes
<img className="image" src={`images/${this.props.image}`} /> this does not work for me when used in this code
<ul className={styles.ListUl}> {this.props.clinicians.map(c => { return ( <li key={c.accountId}> <button onClick={this.handleSetIndividual.bind(this, c)}> <h4>{c.firstName} {c.lastName}</h4> <img src={`${c.profileImageUrl}`} alt="individualImage" height="100" width="100" /> </button> </li> )} )} </ul> All other props work such as the names this just has to do with getting the src param access to those props.
using src={c.profileImageUrl} as you suggested was tried already and is read by the browser as absolutely nothing. As in there is no src param any more. like this:
<img alt="profileImage" height="100" width="100"> The way I did it src={`${c.profileImageUrl}`} is read as src="undefined" if I take the $ symbol off of it it reads src="c.profileImageUrl"
Thanks in advance for the help!
console.log(c);before you return, do you seeprofileImageUrlas a defined property on that object? It could be you have different case or a typo somewhere. Also, you can simplify that image line by making it:<img src={c.profileImageUrl} alt="individualImage" height="100" width="100" />