title: How to clone an array into useState hook
body: <p>This might be stupid question however, I failed an interview because of this so asking.
  Does any one know how to clone an array of numbers into state.
  I have seen examples of objects.
  I have tried spread operator no luck, tried JSON.parse no luck.</p>
  <pre><code>const [Sorted,setSorted]=useState([])
  let a=[1,3,5]
  let b=[2,4,6]
  function sorts(){
        let c=[...a,...b];
        return(c.sort());//it will return[1,2,3,4,5,6]
  }
  useEffect(()=&gt;{
      let sortedArr=sorts();
      setSorted([...sortedArr]);//No use
      setSorted(JSON.parse(JSON.stringify(sortedArr));//No use
  },[])
  
  
  //Printing using Map
  </code></pre>
  <p>Please ignore any typing mistakes.
  Thank you</p>