Itertating array data into a Material UI table

I am trying to create a table to list all of my users in one go but I am having trouble getting it to display properly.

If I have two arrays to mix in (one of column names and one for where the main array user list should these go inside the return statement? I am stuck at the minute were it is either outputting nothing on a blank screen or throwing this error.

const columns = [
        { field: 'id', headerName: 'ID', width: 70 },
        { field: 'firstname', headerName: 'First name', width: 130 },
        { field: 'lastName', headerName: 'Last name', width: 130 },
        { field: 'userName', headerName: 'Username', width: 130},
        { field: 'userEmail', headerName: 'Email', width: 180 },
        { field: 'userRole', headerName: 'Role', width: 80}
    ];
    const rows = [
        { id: userLists.userID, firstname: userLists.userFirstName, lastName: userLists.userSurname,  userName: userLists.username, userEmail: userLists.userEmail, userRole: userLists.userRoleID },
    ];


    return (

        <div style={{ height: 400, width: '100%' }}>
        {userLists.map(( {}) => {
         return   <DataGrid rows={rows} columns={columns} pageSize={10} checkboxSelection />
     })}
        </div>
    );
}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.