title: How to add my own js script to react?
body: <p>I have scirpt for mobile multilevel menu. How can I get it work in react? I have something like this:</p>
  
  <pre><code>export function mobileNavigation() {
    let navElements = document.querySelectorAll('.nav');
    let backButton = document.querySelector('.back-nav');
  
    navElements.forEach(el =&gt; {
      el.addEventListener('click', itemClicked)
    })
    //more code
  }
  </code></pre>
  
  <p>Then in my mobilenav component i have:</p>
  
  <pre><code>componentDidMount() {
    mobileNavigation();
  }
  </code></pre>
  
  <p>But it doesnt work.. I mean I know why but I don't know how to solve it. How can I get my script available the whole time not only once when component mounts?</p>