I am attempting to load a local image in React js. Following this answer, this is how I've attempted this -
<img src={require('../public/images/icon.png').default} />
Where the image is icon.png located in my public folder and I'm writing this in the export default function Home() { return (
portion of my index.js. This is how the image renders:
I have deployed this to Vercel as well as tested locally, so I do not think this is a server issue. I've tried the import method described here as well.
What is wrong here and how can I load a local image?