title: React native listview rowhaschanged
body: <p>i 'm learning listview of react native, but i keep wonder what is the purpose of rowhaschanged like why we have to use it, when it will be called. I have read many document about it also the same questions on stackoverflow then i tried to catch rowhaschanged by updating a listview to understand it better but it wasn't be called. Can somebody give me exact answers for above questions and help me call rowhaschaned please. Thank for your help </p>
  
  <pre><code>export default class HelloWorldApp extends Component {
    constructor (props)
    {
      console.log ();
       super(props);
       /*
       this.ds = new ListView.DataSource ({rowHasChanged: (r1,r2) =&gt; {
        console.log ('Row Has Changed was called');
        return r1 !== r2} });
        */
       this.state = {
         source :  new ListView.DataSource ({rowHasChanged: (r1,r2) =&gt; {
          console.log ('Row Has Changed was called');
          return r1 !== r2} })
       };
    }
    hitMe ()
    {
      console.log ('hit me');
      this.setState ({
        source: this.state.source.cloneWithRows([
          {name: 'Tu', age: 4},
          {name: 'Hau', age : 5},
          {name: 'Nguyen', age: 7},
          {name: 'Duy', age: 7}
        ])
      });
    }
  
  
    render () {
      return (
        &lt;View style = { {padding: 10} }&gt;
          &lt;ListView
           dataSource = {
            this.state.source
           }
           renderRow = { (data) =&gt; &lt;Text&gt; {data.name} is {data.age} &lt;/Text&gt; } 
          /&gt;
          &lt;Button onPress = {this.hitMe.bind(this)} title  = 'Click me' /&gt;
  
  
        &lt;/View&gt;
  
  
  
  
      );
    }
  }
  </code></pre>