I am trying to learn React, and I am following a video course to do so. I've entered in the code exactly as it appears on the screen; it's working in the video, but not for me.
Here is the code:
<img alt='robot' src={'https://robohash.org/${props.id}?size=200x200'} />
It's telling my that the src is
Unexpected template string expression: no-template-curly-in-string
What is going on here? I'm using VSCode as my editor.
eslint caught ur mistake. which is template literal usage expression with '
.
Mistake,
<img alt='robot' src={'https://robohash.org/${props.id}?size=200x200'} />
const props = {id: "someId"}
console.log('https://robohash.org/${props.id}?size=200x200')
Try, changing '
with `,
<img alt='robot' src={`https://robohash.org/${props.id}?size=200x200`} />
const props = {id: "someId"}
console.log(`https://robohash.org/${props.id}?size=200x200`);