I have an image uri that i want to pass as prop so that i can load it when it when the component is rendered. as i will be changing images i cannot have a static uri. but i keep getting this error
Error: Cannot find module "."
although it does work when i statically load the images. Also i need to use the img element and not Image.
require('./cube.jpg')
here is my code
here is my parent class declaring the component:
<InputSection ref="inputS" ImD={this.getData} imageUri={this.state.imageurl} />
imageurl state is defined as:
imageurl: './cube.jpg',
child component:
return(
<div style={style}>
<br/>
<img ref="image" src={require(this.props.imageUri)} onLoad={this._onImageChanged.bind(this)} />
<canvas style={{display:'none'}}width={300} height={300} ref="inputCanvas" >
</canvas>
</div>
);