I am trying to make a simple iframe in my responsive component that will show the location of the google map. I am currently hard coding src like this
this.state.features.map(function(school){
return(
<div>
{school.name}
<div>
<iframe frameBorder="0" style={{ width: "100%", height: "450"}}
src="https://www.google.com/maps/embed/v1/place?q=40.7127837,-74.0059413&key=AIzaSyCc3zoz5TZaG3w2oF7IeR-fhxNXi8uywNk">
</iframe>
</div>
</div>
)
})
which seems to work. However, I want to pass scr using the response variable so I am doing something like this
const MY_API = AIzaSyCc3zoz5TZaG3w2oF7IeR-fhxNXi8uywNk
let _url = "https://www.google.com/maps/embed/v1/place?q=40.7127837,-74.0059413&key="+MY_API;
and then passing src dynamically like this
<iframe frameBorder="0" style={{ width: "100%", height: "450"}}
src={_url}>
</iframe>
but now i get the following error
The Google Maps API server rejected your request. Invalid request. Unexpected parameter 'amp% 3Bkey'
Not sure what the error message is. Please help me.
source
share