title: Adding background image in React JS
body: <p>I decided to use inline JS styles in React. Everything is ok except images. Here I try to add a background image to div but I get errors.</p>
  
  <pre><code>import React, {Component} from 'react';
  import ReactDOM from "react-dom";
  
  var styles = {
  color:'violet',
  backgroundImage: 'url(' + require('./sun.png') + ')' 
  };
  
  class App extends React.Component {
    render() {
      return (
      &lt;div&gt;
          &lt;h1&gt;How to make smth&lt;/h1&gt;
          &lt;div style={styles}&gt;test&lt;/div&gt;
      &lt;/div&gt;
      )
    }
  }
  
  ReactDOM.render(&lt;App/&gt;, document.getElementById('root'));
  </code></pre>
  
  <p>I get errors, and I just dont know what loader do i need and how to add it to the webpack config (or package.json)</p>
  
  <p><a href="http://i64.tinypic.com/24ni99u.png" rel="nofollow noreferrer">here is what i get</a></p>