Error with MUI-dataTables when i get data from API

Solution for Error with MUI-dataTables when i get data from API
is Given Below:

enter image description herecodeI tried to get data from API and show it with MUI-dataTables
but this error occurred (you can see it in attached image) I using it with create react app
**

import React,{useEffect,useContext, useState} from 'react'
import MUIDataTable from "mui-datatables";
import axios from'axios'
const columns = [
    {
        name: "name",
        label: " name",
        options: {
      filter: true,
      sort: true,
     }
    },
    {
        name: "username",
     label: " username",
     options: {
      filter: true,
      sort: true,
     }
    },
    {
        name: "email",
     label: "email",
     options: {
      filter: true,
      sort: true,
     }
    },
   ];
   

   


const options = {
    filterType: 'checkbox',
    serverSide: true
};

function Users() {
    const [users,setUsers]=useState('');
    useEffect(()=>{
      const getUsers = async ()=>{
         await axios.get('https://jsonplaceholder.typicode.com/users').then(response=>{
            setUsers(response.data);
         })
      };
      getUsers();
    },[])
    return (
        <div>
             <MUIDataTable
                title={" Users"}
                data={users}
                columns={columns}
                options={options}
            />
        </div>
    )
}

export default Users

Because props data in MUIDataTable is required an array. While fetching API, the users is a string “ (because const [users,setUsers]=useState('');). So this error appear.

To fix, you need to update initial value of users is an array like this:

[users,setUsers]=useState([]);