title: behavior of arrow function vs normal function in onPress method
body: <p>'m learning native react and learning more about javascript, so I still do not understand many things about its behavior. I have created a button component, using TouchableOpacity, and its props onPress.
  For it to work, I must send the function I want to execute as a props, but here I have fallen due to my little experience.</p>
  
  <p>I am sending a console.log that is activated when I press the button. So I passed the console.log directly in the props that I defined, but it did not work when I clicked on the button, but, it was executed when the code is initialized. On the other hand, when I have passed an arrow function that contains the console.log, it has been executed at the moment of clicking the button.</p>
  
  <p>to make it clearer I'll show my code:</p>
  
  <p>this is my button component:</p>
  
  <pre><code>const Button = ({ onUserPress, children, color }) =&gt; {
  
      const state = {
  
      };
      return (
          &lt;TouchableOpacity onPress={ onUserPress } style={styles.buttonStyle} &gt;
              &lt;Text style={styles.textStyle}&gt;
                  {children}
              &lt;/Text&gt;
          &lt;/TouchableOpacity&gt;
      );
  };
  </code></pre>
  
  <p>and i call them like this:</p>
  
  <pre><code>&lt;Button onUserPress={ console.log("hello") }&gt;Something&lt;/Button&gt;
  </code></pre>
  
  <p>This is executed at the time of initializing my application, and nothing is happened when the button is pressed.</p>
  
  <p>on the other hand, when i use the same component, but i pass the console.log in arrow function, like this:</p>
  
  <pre><code>&lt;Button onUserPress={ ()=&gt;{console.log("hello")} }&gt;Something&lt;/Button&gt;
  </code></pre>
  
  <p>this execute the console log only when i press the button component.</p>
  
  <p>Could someone explain to me why the behavior is different? The world of functional programming is totally new to me and these things seem strange to me. According to what I understand, both are functions, so for me they do not make a difference (obviously, from my ignorant point of view). What is the difference that makes the behavior different?</p>