My User data include one id,userName and one password.
I am trying to send the data I have as an Object array.It goes one by one with .map annotation, but I want to send it as a whole array. Is this possible? Coming in json format from my database. I want to send my objects as an array to the User Table file. It goes undefined. How can an object array be sent as props?
function User() { const [userList,setUserList] = useState([]) const [error,setError] = useState(null); const getAllUsers = async() =>{ const a = await axios.get(BASE_URL +"/users/all") setUserList(a.data); } useEffect(()=>{ getAllUsers() .then(()=>{ console.log("Users Promise") }) return(<div> {<UserTable data = {userList} />}</div> ) }UserTable.jsxfunction UserTable({props}) { debuggerconst {id,userName,password} = props; // It comes undefined here. console.log(props)}