title: Distinguish between img & svg when passed down as a prop in React
body: <p>Assume I have a component <code>&lt;MyComponent /&gt; that takes in prop called</code>src<code>the</code>src<code>prop can take in</code>svg<code>as well as a</code>img`</p>
  
  <pre><code> &lt;MyComponent src={someSvgComponent} /&gt;
  </code></pre>
  
  <p>Or</p>
  
  <pre><code> &lt;MyComponent src={someImgComponent} /&gt;
  </code></pre>
  
  <p>How do I check if the passed prop in <code>src</code> is an image or an svg? An image can be of type jpeg|jpg|png|gif</p>
  
  <p>Now the <code>src</code> prop can either pass the file or the path of the file.</p>