title: React: Pass Function with JSON Data
body: <p>I am trying to generate components from a JSON file with React-Native, and am wondering what is the best way to pass a function to a component as a <code>prop</code>?</p>
  
  <p>Example, <code>button</code> requires the prop <code>onPress</code>, so is there a way to pass in a function to the object <code>onPress</code> as I have done here:</p>
  
  <pre><code>{
        component: "Button",
        props: {
              title: "This is the Title",
              onPress: {() =&gt; {Alert.alert("Tapped!")}}
        }
  }
  </code></pre>
  
  <p>As this generates an unexpected token error, what is a better way to accomplish this?</p>