Let's say I have a React.js component called CountryFlag. I also have a directory of SVG images for each country's flag at countries/
This component takes a single prop - countryCode. This would be something such as ES for Spain.
How can I use the ES6 import construct with this.props.countryCode when this.props is not in scope?
I have tried to do this in componentDidMount() but get a syntax error:
Syntax error: 'import' and 'export' may only appear at the top level (6:2)
<Isvg src={this.props.svgImage}/>