title: Creating dynamic array in react js
body: <p>I'm trying to create an array dynamically by getting user input. <code>range</code> comes as a parameter. When I try to <code>console.log()</code> that it logs the correct value of range, but when I try to use it in <code>const a=Array(...Array(range).keys());</code> it doesn't take range as correct parameter. When I hard code a number instead of range it gives a correct array. What would be the problem here??</p>
  <pre><code>import React from 'react';
  import { Button, TextField } from '@material-ui/core';
  import { useState } from 'react';
  
  export default  function handleSumOfMultipliers(multiplier, range) {
      console.log(&quot;range&quot; + range)
      
      const a = Array(...Array(range).keys());
      console.log(a);
  
      return (
          &lt;div&gt;&lt;/div&gt;
      );
  };
  </code></pre>