I've read the docs about this but my attempt has proven incorrect. I am trying to display a embedded video based on the artist page being viewed. In my Json file I have a featuredVideo key which contains the embedded video url. But when I use featuredVideo in my artist component, nothing displays on the screen. Any help would be greatly appreciated! Here is my video component:
import React from 'react'
const Video = ({ featuredVideo, videoTitle, ...props }) => (
<div className='video'>
<iframe
src={featuredVideo}
title={videoTitle}
allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture'
frameBorder='0'
webkitallowfullscreen='true'
mozallowfullscreen='true'
allowFullScreen
/>
</div>
)
export default Video
Here is my artist component:
import Video from './components/video'
const ArtistContainer = ({ data }) => {
const classes = useStyles()
const {
firstName,
lastName,
city,
currentTeam,
bio,
twitter,
instagram,
email,
whatWeLove,
featuredVideo,
recentPerformance,
} = data.artistsJson
return (
...
<Video src={`https://www.youtube.com/embed/${featuredVideo}`} />
Here is some of the Json file:
"artistId": 59,
"firstName": ["FirstName"],
"lastName": ["LastName"],
"bio": "This is a tester statement for dev purposes. -- blah blah blah blah blah blah blah -- blah blah blah blah blah blah blah",
"highlight": "",
"events": ["Winter 2020"],
"featuredVideo": "C0eBTtXYTp0",
"currentTeam": "CurrentTeam",
"instagram": "https://www.instagram.com/wolfofvillage/",
"city": "City",
"tiktok": "",
"twitter": "https://www.twitter.com/test",
"youtube": "",
"email": "test@email.com",
"address": "",
"phoneNumber": "",
"whatWeLove": "This is a tester statement for dev purposes -- blah blah blah blah blah blah blah.",
"recentPerformance": "06/08/2020"
}