title: Call JS function from another file in React?
body: <p>I have a function in a separate JavaScript file that I would like to call in a React component - how can I achieve this?</p>
  
  <p>I'm trying to create a slideshow, and in <code>slideshow.js</code>, I have this function that increases the current slide index, like so:</p>
  
  <pre><code>function plusSlides(n) {
      showSlides(slideIndex += n);
  }
  </code></pre>
  
  <p>In <code>Homepage.jsx</code>, I have a "next" button that should call <code>plusSlides</code> from <code>slideshow.js</code> when it is clicked, like so:</p>
  
  <pre><code>class NextButton extends React.Component {
      constructor() {
          super();
          this.onClick = this.handleClick.bind(this);
      }
  
      handleClick (event) {
          script.plusSlides(1); // I don't know how to do this properly...
      }
  
      render() {
          return (
              &lt;a className="next" onClick={this.onClick}&gt;
                  &amp;#10095;
              &lt;/a&gt;
          );
      } 
  }
  </code></pre>