title: React.js return a style property from a function and use it inside the render() function
body: <p>Im trying to use a dynamic style property. The approach below throws me an "The <code>style</code> prop expects a mapping from style properties to values, not a string" error.</p>
  
  <pre><code>class someClass extends React.Component {
      someFunction = () =&gt; {
          return {marginLeft : 20 };
      }
      render() {
          return( &lt;div style={this.someFunction}/&gt;
          );
      }
  }
  </code></pre>
  
  <p>Howerver this one works:</p>
  
  <pre><code>class someClass extends React.Component {
      render() {
          return( &lt;div style={{marginLeft : 20}}/&gt;
          );
      }
  }
  </code></pre>
  
  <p>Why is that so and how can i return style objects from functions?</p>
  
  <p>Thanks for any answers in advance!</p>