I want to import an image into my react native app locally.
render() {
console.log(this.props.image); // this logs '../../images/avatartest.jpg' every time
let test = require (this.props.image!); // bang is required because of interface
return (
<ImageBackground
source={test}
>
</ImageBackground>
);
}
Running this code produces this error:
Is there no way to accept a variable name that has a string?

!in requirerequire (this.props.image!)