title: Accessing class property via this in an event call
body: <p>I'm trying to acces a class property via 'this' in a callback function of an onClick event, but there is a scope-issue and the property isn't defined.</p>
  <p>I've tried a couple of setups, but I think I'm just hitting myself in my confusion more than anything.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class MyClass extends React.Component {
      constructor(props) {
          super(props)
          this.myProperty = "myValue"
      }
  
      onElementClicked = (event, other, parameters) =&gt; {
          console.log(this.myProperty) //Undefined.
      }
      
      render() {
          return (
              &lt;div&gt;
                  &lt;SubElement click={this.onElementClicked} /&gt;
              &lt;/div&gt;
          )
      }
  }
  
  function SubElement({ click }) {
      const number = "Click me", other = null, parameters = null;
      return (
          &lt;p&gt;
              &lt;span onClick={e =&gt; click(e, other, parameters)}&gt;    
                      {number}
              &lt;/span&gt;
          &lt;/p&gt;
      );
  }
  
  ReactDOM.render(
      &lt;MyClass /&gt;,
      document.querySelector("main")
  );</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"&gt;&lt;/script&gt;
  &lt;main&gt;Please enable JS&lt;/main&gt;</code></pre>
  </div>
  </div>
  </p>