title: How to call a function from another class in React-Native?
body: <p>I am working on React-Native, i want to call a function from different class but when i am trying to do it's showing some error.</p>
  
  <p><strong>Class A</strong></p>
  
  <pre><code>import B from './B.js';
  
  class A extends Component {
      _onItemPressed(item){
          B.abc();
      }
  
      render() {
        return (
           &lt;TouchableHighlight
              underlayColor={Colors.colors.lightgrey}
              style={{padding: 15}}
              onPress={this._onItemPressed.bind(this)}&gt;
           &lt;Text&gt;Click Me !&lt;/Text&gt;
           &lt;/TouchableHighlight&gt;
        );
      }
  }
  </code></pre>
  
  <p><strong>Class B</strong></p>
  
  <pre><code>class B extends Component {
  
      abc(){
        alert('Hello World');
      }
  
      render() {
        return (
           &lt;View&gt;
              &lt;Text&gt;Welcome to React Native&lt;/Text&gt;
           &lt;/View&gt;
        );
      }
  }
  </code></pre>
  
  <p>But error message is coming after pressing the button in Class A, '<strong>undefined is not a function (evaluating 'B.default._abc()')</strong>'</p>
  
  <p>Please kindly go through my post and suggest me some solution.</p>
  
  <p>Thanks</p>