title: How to GET image in reactjs from api?
body: <p>I am fetching an image from nodejs API after verifying with JWT token.
  I am getting GET 200 ok response in browser Network header and picture can be seen in Preview, but I cannot use it in my app.</p>
  
  <p>I am surely doing something wrong. Please let me know the proper way to display image from API.
  On my backend nodejs, I am using res.sendFile to send the file.</p>
  
  <pre><code>class Card extends Component {
   constructor({props, pic, token}) {
  super(props, pic, token);
  this.state = { 
    pic: pic,
  };
  
  urlFetch(data) {
   fetch(data, { 
   headers: new Headers({
   'authorization': `Bearer ${this.props.token}`, 
   'Content-Type': 'application/json'
   })
  })
  .then(response =&gt; {
   if (response.statusText === 'OK') {
    return data   // OR return response.url
    }
   })
  }
  
  render() {
  const { pic } = this.state;
  
   return (
          &lt;div&gt;
            &lt;img style={{width: 175, height: 175}} className='tc br3' alt='none' src={ this.urlFetch(pic) } /&gt;
          &lt;/div&gt;
         );
        }
       }
  </code></pre>