score:0

you can do this

<img src={require(${this.props.yourpropname})} alt="my image"/>

and take any name as a prop in the tag and then pass it!!

score:3

did you try the other way around? i am assuming you will import the images in your parent component. also the reason you are getting that error is probably because your parent component and child component are not in the same directory. the image path is ./cube relative to parent which means it resides in the same directory as parent.

parent component

<inputsection ref="inputs" imd={this.getdata} imageuri={require(this.state.imageurl)} />

child component

<img  ref="image" src={this.props.imageuri} />

Related Query

More Query from same tag