React hooks pagination

I’m getting this message in the console when trying to calculate the number of pages in the page, it doesn’t allow me to get this calculation with this function: setTotalPages(Math.ceil(dataArr.length/ NUM_CLIENTS_PAGE)). Does anyone have an idea what’s going on? I can’t go forward for this reason ** const[totalPages, setTotalPages]=useState(0)** ** ** setTotalPages(Math.ceil(dataArr.length/ NUM_CLIENTS_PAGE))** ** ** setTotalPages(Math.ceil(dataArr.length/ NUM_CLIENTS_PAGE))**.

Could someone tell me how I can fix it and what the message in the console means:

But I get this message in the console: State updates from the useState() and useReducer() Hooks don’t support the second callback argument.

setTotalPages ƒ dispatchAction(fiber, queue, action) {
{
if (typeof arguments[3] === ‘function’) {
error("State updates from the useState() and useReducer() Hooks don’t support the " + 'secon…

import React, { useState, useEffect} from "react";
import {v4 as uuidv4} from "uuid";
import axios from "axios";
import Table from "./Table";
import Pagination from "./Pagination";
import { NUM_CLIENTS_PAGE } from "../utils/constants";
import "./components.css"


const Container=()=>{
    const[ clients, setClients ] = useState([]);
    const[ loading, setLoading ] = useState(false);
    const[ page, setPage ] = useState(1);
    const[totalPages, setTotalPages]=useState(0)


    useEffect(()=>{
        const fetchData= async()=>{
            try{
                setLoading(true);
                const res= await axios.get("data.json");
                const dataArr=res.data;
                dataArr.map((obj)=>obj.id= uuidv4());
               
                setClients(dataArr);
                setLoading(false)
                setTotalPages(Math.ceil(dataArr.length/ NUM_CLIENTS_PAGE))
                /* console.log(dataArr.length/NUM_CLIENTS_PAGE) */
                
                console.log("setTotalPages",setTotalPages)
               
              
            }catch(error){
                console.log(error)
            }

           
       
        }
        fetchData()
        
        

    },[]);

    

    return(
        <>
        <div className="container">
           {/*  {(clients.map((client)=>client.id=uuidv4()))} */}
            <Table clients={clients}/>
            <Pagination />

        </div>

        </>


    )



}
export default Container;