#Icon issue in the React Router Vanlife project

2 messages · Page 1 of 1 (latest)

floral karma
#

Hi everybody. I have discovered an error in Vanlife. It takes place when, in the host restricted area you select a van, any van. When you reload the page the avatar icon is lost. Has anybody seen this? Thanks in advance. Regards 😊

soft seal
#

I think Bob "from the future" added a part for that in the course.
You need to make sure you import the image and use it as the image url instead of using relative path.
eg.:

// This will cause trouble
const TroubelCausingComponent = () => {
  return <img src="../super-avatar.png" alt="super avatar" />
}

import SuperAvatar from '../super-avatar.png'

const SuperComponent = () => {
  return <img src={SuperAvatar} alt="super avatar" />
}