title: React Native passing functions with arguments as props
body: <p>From what I have read its best to try and structure react apps with as many components as "dumb" renderers. You have your containers which fetch the data and pass it down to the components as props.</p>
  
  <p>That works nicely until you want to pass functions down the chain that require arguments other than events.</p>
  
  <pre><code>class MyClass extends Component {
  
  
    _onItemPress (myId) {
      // do something using myId
    }
  
    render () {
  
      return &lt;MyComponent myID={10} onPress={(myId) =&gt; this._onItemPress(myId)} /&gt;
  
    }
  
  }
  </code></pre>
  
  <p>If I simply pass that as my onPress handler to MyComponent it won't return myId when called. To get around this I end up doing something like this.</p>
  
  <pre><code>export default ({myId, onPress) =&gt; {
    const pressProxy = () =&gt; {
      onPress(myId)
    }
  
    return (
      &lt;TouchableHighlight onPress={pressProxy}&gt;
        &lt;Text&gt;Click me to trigger function&lt;/Text&gt;
      &lt;/TouchableHighlight&gt;
    )
  }
  </code></pre>
  
  <p>Am I doing this completely incorrectly? I would like to be able to have a simple component that I can re-use for list items where its sole function is to take a title, onpress function and return a list item to be used in ListViews renderRow function. Many of the onPress functions will require variables to be used in the onPress however.</p>
  
  <p>Is there a better way?</p>