title: How to pass image url as prop in React
body: <p>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 </p>
  
  <pre><code>Error: Cannot find module "."
  </code></pre>
  
  <p>although it does work when i statically load the images. Also i need to use the img element and not Image.</p>
  
  <pre><code>require('./cube.jpg')
  </code></pre>
  
  <p>here is my code </p>
  
  <p>here is my parent class declaring the component:</p>
  
  <pre><code>&lt;InputSection ref="inputS" ImD={this.getData} imageUri={this.state.imageurl} /&gt;
  </code></pre>
  
  <p>imageurl state is defined as:</p>
  
  <pre><code>imageurl: './cube.jpg',
  </code></pre>
  
  <p>child component:</p>
  
  <pre><code>return(
  &lt;div style={style}&gt;
  
  &lt;br/&gt;
  
  &lt;img  ref="image" src={require(this.props.imageUri)} onLoad={this._onImageChanged.bind(this)} /&gt;
  &lt;canvas style={{display:'none'}}width={300} height={300} ref="inputCanvas" &gt;
  
  &lt;/canvas&gt;
  &lt;/div&gt;
  );
  </code></pre>