Setting a backgroundImage With React Inline Styles
<p>I'm trying to access a static image to use within an inline <code>backgroundImage</code> property within React. Unfortunately, I've run up dry on how to do this.</p>
<p>Generally, I thought you just did as follows:</p>
<pre><code>import Background from '../images/background_image.png';

var sectionStyle = {
  width: &quot;100%&quot;,
  height: &quot;400px&quot;,
  backgroundImage: &quot;url(&quot; + { Background } + &quot;)&quot;
};

class Section extends Component {
  render() {
    return (
      &lt;section style={ sectionStyle }&gt;
      &lt;/section&gt;
    );
  }
}
</code></pre>
<p>This works for <code>&lt;img&gt;</code> tags. Can someone explain the difference between the two?</p>
<p>Example:</p>
<p><code>&lt;img src={ Background } /&gt;</code> works just fine.</p>
<p>Thank you!</p>