title: getting undefined message from useEffect console log reactjs
body: <p>Here is the response data returned from console.log(response.data) in the useEffect.</p>
  <p><a href="https://i.stack.imgur.com/NK5Kv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NK5Kv.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/gvEM5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gvEM5.png" alt="enter image description here" /></a></p>
  <p>And the code here:</p>
  <pre><code>const [userData, setUserData] = useState([])
  const [categoryList, SetCategoryList] = useState([])
  
  useEffect(async() =&gt; {       
          const response = await Axios.get(process.env.REACT_APP_FETCH_URL + '/api/users/allusers', {withCredentials:true})
      console.log(response.data) //return data
      console.log(response.data.categoryaccess) //undefined
      SetCategoryList(response.data.categoryaccess)
      setUserData(response.data)     
      }, [])
  </code></pre>
  <p>What I am trying to achieve is to join the array as one string. For example, 5feb2122a8632e0550deb43b,5fec781a52b5cf23c0f34333,5fedeec19604432ac034bf89 separated by a comma.</p>
  <p>How do I access the categoryaccess array data and join them as a single string? Many thanks in advance and greatly appreciate any helps. thanks</p>