title: Add external javascript file to React.js app
body: <p>I'm having a little problem adding external javaScript file to my React App. I tried so many things but none of them worked. The last thing I did is:</p>
  
  <p>step#1 : creating JS file and create functions.</p>
  
  <p>step#2 : import the functions form my js file. </p>
  
  <p>step#3 : call the functions. </p>
  
  <p>The issue is when I run: npm start, everything work fine. But when I  run: nom build, the script won't work!</p>
  
  <p>This is my js file that I created with exporting functions  </p>
  
  <pre><code>            export function BackgroundMove() {
              $(document).ready(function() {
                  let movementStrength = 25;
                  let height = movementStrength / $(window).height();
                  let width = movementStrength / $(window).width();
                  $("body").mousemove(function(e){
                          let pageX = e.pageX - ($(window).width() / 2);
                          let pageY = e.pageY - ($(window).height() / 2);
                          let newvalueX = width * pageX * -1 - 25;
                          let newvalueY = height * pageY * -1 - 50;
                          $('body').css("background-position", newvalueX+"px     "+newvalueY+"px");
                  });
                  });
              }
  
  
              export function HeaderMove() {
                  $(document).ready(function(){
                      $('#nav-icon0,#nav-icon1,#nav-icon2,#nav-icon3,#nav-icon4').click(function(){
                          $(this).toggleClass('open');
                      });
                  });
              }
  </code></pre>
  
  <p>Here I'm importing my functions</p>
  
  <pre><code>    import {HeaderMove, BackgroundMove} from '../../style';
  </code></pre>
  
  <p>Calling the functions:</p>
  
  <pre><code>   componentDidMount() {
        HeaderMove();
        BackgroundMove();
      }
  </code></pre>
  
  <p>As I mentioned, this will work fine when I run</p>
  
  <pre><code> npm start 
  </code></pre>
  
  <p>But, when I run </p>
  
  <pre><code>npm build
  </code></pre>
  
  <p>my script won't work</p>