title: React - pass array values from arrow function to another .js file
body: <p>I'm pretty new to React and development at all, so please don't mind this "easy" question.</p>
  
  <p>I have one file "CreateRandomArray.js" which will fill an array with random numbers under 10 and checks if this number already exists.</p>
  
  <pre><code>import React from 'react';
  
  const createRandomArray = () =&gt; {
  
  const array = [];
  let indexer = 0;
  
  do {
      let randomnumber = Math.floor(Math.random()*30)
      if ( randomnumber &lt; 10){
          let result = array.includes(randomnumber)
          console.log(result)
          if (!result) {
              array[indexer] = randomnumber
              indexer = indexer + 1
          } null
      } null
   } while (indexer &lt; 10)
  }
  
  export default createRandomArray
  </code></pre>
  
  <p>Now I would love to use this array in another file but I can't find a way to get access to the value in this array. I already did several versions with "return" but it never worked.</p>
  
  <p>So, does anyone knows how I can make use of this array in another .js file and assign those values for example to another array?</p>
  
  <p>Thank you :)</p>
  
  <p>ps: If you could explain it like you would explain it to an ape, it would be much appreciated ^^</p>