Not sure why this works:
import React from 'react';
import './imageDisplay.css';
// /src/content/GandJBoat.jpg'
const ImageDisplay = (props) =>
(
<div className='imageContainer'>
{/* <img src={require(`${props.imageSource}`)} alt="" /> */}
<img src={require('../../content/GandJBoat.jpg')} alt=''/>
</div>
);
export default ImageDisplay;
and this doesn't:
import React from 'react';
import './imageDisplay.css';
// /src/content/GandJBoat.jpg'
const ImageDisplay = (props) =>
(
<div className='imageContainer'>
<img src={require(`${props.imageSource}`)} alt="" />
{/* <img src={require('../../content/GandJBoat.jpg')} alt=''/> */}
</div>
);
export default ImageDisplay;
when I run the second one I get the error
I have no idea why the two would be different? I've tried quite a few different ways now and I'm not sure why it would behave like this. I want to randomly display images, the top level function passes a random image url to the component.