I'm creating an app of movies/series Database and its almost done,there is a problem. I created a button that goes to youtube to see the trailer of movie but it doesn't work.
I tried two things but they didn't solve my problem:
<TouchableOpacity onPress={() => {
Linking.openURL('https://www.youtube.com/watch?v=${details.key.toString()}');
}}
>
<TouchableOpacity onPress={() => {
Linking.openURL('https://www.youtube.com/watch?v=${details.key}');
}}
>
{details.key} is the key of movie in youtube trailer, any solutons please?
Use backtick instead of single quote and make sure details.key exist. Maybe something like:
`https://www.youtube.com/watch?v=${details?.key}`
The question mark makes sure details data is fetched.